From 1a879479d1b053ba50ab249073c3e063c4d65279 Mon Sep 17 00:00:00 2001 From: yiliang114 Date: Tue, 14 Jul 2026 15:05:58 +0800 Subject: [PATCH 1/6] fix(ci): isolate web-shell Playwright smoke runner --- .github/workflows/ci.yml | 27 ++-------------------- scripts/tests/no-ak-integration-ci.test.js | 9 +++++--- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d6ce0c0cc9e..922bc71cf9b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -377,7 +377,7 @@ jobs: needs.classify_pr.outputs.skip_ci != 'true' && needs.test.outputs.ci_profile == 'full' }} - runs-on: '${{ fromJSON(needs.classify_pr.outputs.ubuntu_runner || ''["ubuntu-latest"]'') }}' + runs-on: 'ubuntu-latest' timeout-minutes: 20 permissions: contents: 'read' @@ -398,9 +398,7 @@ jobs: exit 1 fi - # Self-hosted can't reach nodejs.org reliably; reuse the machine's Node. - - name: 'Set up Node.js 22.x (hosted)' - if: "${{ runner.environment == 'github-hosted' }}" + - name: 'Set up Node.js 22.x' uses: 'actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e' # v6.4.0 with: node-version: '22.x' @@ -408,27 +406,6 @@ jobs: cache-dependency-path: 'package-lock.json' registry-url: 'https://registry.npmjs.org/' - - name: 'Use pre-installed Node.js (self-hosted)' - if: "${{ runner.environment == 'self-hosted' }}" - run: |- - if ! command -v node >/dev/null 2>&1; then - echo "::error::Node.js is not on PATH for this self-hosted runner. Provision Node 22.x or set the MAINTAINER_ECS_RUNNER_DISABLED repository variable to 'true' to route PRs back to hosted runners." - exit 1 - fi - echo "Using pre-installed Node $(node -v) / npm $(npm -v)" - if [[ "$(node -p 'process.versions.node.split(".")[0]')" != "22" ]]; then - echo "::warning::Expected Node 22.x but found $(node -v); web-shell smoke tests will run against the runner's Node." - fi - - - name: 'Configure persistent npm cache (self-hosted)' - if: "${{ runner.environment == 'self-hosted' }}" - run: |- - cache_dir="${HOME}/.cache/qwen-code/npm" - mkdir -p "${cache_dir}" - echo "NPM_CONFIG_CACHE=${cache_dir}" >> "${GITHUB_ENV}" - echo "Using persistent npm cache at ${cache_dir}" - du -sh "${cache_dir}" 2>/dev/null || true - - name: 'Configure npm for rate limiting' run: |- npm config set fetch-retry-mintimeout 20000 diff --git a/scripts/tests/no-ak-integration-ci.test.js b/scripts/tests/no-ak-integration-ci.test.js index 93ba25e73a94..a6d150b43487 100644 --- a/scripts/tests/no-ak-integration-ci.test.js +++ b/scripts/tests/no-ak-integration-ci.test.js @@ -109,14 +109,17 @@ describe('no-AK integration CI wiring', () => { expect(webShellJob).toContain('github.event.pull_request.head.sha'); }); - it('keeps the lightweight coverage comment job on the hosted runner', () => { + it('keeps coverage reporting and Playwright installation on hosted runners', () => { const workflow = readFileSync( path.join(ROOT, '.github/workflows/ci.yml'), 'utf8', ); const coverageJob = getWorkflowJob(workflow, 'post_coverage_comment'); + const webShellJob = getWorkflowJob(workflow, 'web_shell_e2e_smoke'); - expect(coverageJob).toContain("runs-on: 'ubuntu-latest'"); - expect(coverageJob).not.toContain('ubuntu_runner'); + for (const job of [coverageJob, webShellJob]) { + expect(job).toContain("runs-on: 'ubuntu-latest'"); + expect(job).not.toContain('ubuntu_runner'); + } }); }); From 68f230240de804e26740bcc81d55a3f0787816f7 Mon Sep 17 00:00:00 2001 From: yiliang114 Date: Tue, 14 Jul 2026 15:45:31 +0800 Subject: [PATCH 2/6] fix(ci): avoid apt on ECS Playwright smoke --- .github/workflows/ci.yml | 34 ++++++++++++++++++++-- scripts/tests/no-ak-integration-ci.test.js | 20 +++++++++---- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 922bc71cf9b0..e9207f1c10e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -377,7 +377,7 @@ jobs: needs.classify_pr.outputs.skip_ci != 'true' && needs.test.outputs.ci_profile == 'full' }} - runs-on: 'ubuntu-latest' + runs-on: '${{ fromJSON(needs.classify_pr.outputs.ubuntu_runner || ''["ubuntu-latest"]'') }}' timeout-minutes: 20 permissions: contents: 'read' @@ -398,7 +398,9 @@ jobs: exit 1 fi - - name: 'Set up Node.js 22.x' + # Self-hosted can't reach nodejs.org reliably; reuse the machine's Node. + - name: 'Set up Node.js 22.x (hosted)' + if: "${{ runner.environment == 'github-hosted' }}" uses: 'actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e' # v6.4.0 with: node-version: '22.x' @@ -406,6 +408,27 @@ jobs: cache-dependency-path: 'package-lock.json' registry-url: 'https://registry.npmjs.org/' + - name: 'Use pre-installed Node.js (self-hosted)' + if: "${{ runner.environment == 'self-hosted' }}" + run: |- + if ! command -v node >/dev/null 2>&1; then + echo "::error::Node.js is not on PATH for this self-hosted runner. Provision Node 22.x or set the MAINTAINER_ECS_RUNNER_DISABLED repository variable to 'true' to route PRs back to hosted runners." + exit 1 + fi + echo "Using pre-installed Node $(node -v) / npm $(npm -v)" + if [[ "$(node -p 'process.versions.node.split(".")[0]')" != "22" ]]; then + echo "::warning::Expected Node 22.x but found $(node -v); web-shell smoke tests will run against the runner's Node." + fi + + - name: 'Configure persistent npm cache (self-hosted)' + if: "${{ runner.environment == 'self-hosted' }}" + run: |- + cache_dir="${HOME}/.cache/qwen-code/npm" + mkdir -p "${cache_dir}" + echo "NPM_CONFIG_CACHE=${cache_dir}" >> "${GITHUB_ENV}" + echo "Using persistent npm cache at ${cache_dir}" + du -sh "${cache_dir}" 2>/dev/null || true + - name: 'Configure npm for rate limiting' run: |- npm config set fetch-retry-mintimeout 20000 @@ -417,9 +440,14 @@ jobs: run: |- npm ci --prefer-offline --no-audit --progress=false - - name: 'Install Playwright Chromium' + - name: 'Install Playwright Chromium (hosted)' + if: "${{ runner.environment == 'github-hosted' }}" run: 'npx playwright install --with-deps chromium' + - name: 'Install Playwright Chromium (self-hosted)' + if: "${{ runner.environment == 'self-hosted' }}" + run: 'npx playwright install chromium' + - name: 'Choose web-shell Playwright port' run: |- port="$(node -e "const net=require('node:net');const server=net.createServer();server.listen(0,'127.0.0.1',()=>{console.log(server.address().port);server.close();});")" diff --git a/scripts/tests/no-ak-integration-ci.test.js b/scripts/tests/no-ak-integration-ci.test.js index a6d150b43487..e84d9b976230 100644 --- a/scripts/tests/no-ak-integration-ci.test.js +++ b/scripts/tests/no-ak-integration-ci.test.js @@ -109,17 +109,27 @@ describe('no-AK integration CI wiring', () => { expect(webShellJob).toContain('github.event.pull_request.head.sha'); }); - it('keeps coverage reporting and Playwright installation on hosted runners', () => { + it('keeps the lightweight coverage comment job on the hosted runner', () => { const workflow = readFileSync( path.join(ROOT, '.github/workflows/ci.yml'), 'utf8', ); const coverageJob = getWorkflowJob(workflow, 'post_coverage_comment'); + + expect(coverageJob).toContain("runs-on: 'ubuntu-latest'"); + expect(coverageJob).not.toContain('ubuntu_runner'); + }); + + it('does not install Linux packages on self-hosted Playwright runners', () => { + const workflow = readFileSync( + path.join(ROOT, '.github/workflows/ci.yml'), + 'utf8', + ); const webShellJob = getWorkflowJob(workflow, 'web_shell_e2e_smoke'); - for (const job of [coverageJob, webShellJob]) { - expect(job).toContain("runs-on: 'ubuntu-latest'"); - expect(job).not.toContain('ubuntu_runner'); - } + expect(webShellJob).toContain('ubuntu_runner'); + expect(webShellJob).toContain( + "if: \"${{ runner.environment == 'self-hosted' }}\"\n run: 'npx playwright install chromium'", + ); }); }); From e8494a849dc768ce4067cd53e46a1d950100bd12 Mon Sep 17 00:00:00 2001 From: yiliang114 Date: Tue, 14 Jul 2026 17:31:19 +0800 Subject: [PATCH 3/6] fix(ci): enable manual ecs smoke validation --- .github/workflows/ci.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9207f1c10e6..e509827ae4df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,14 @@ on: required: true default: 'main' type: 'string' + linux_runner: + description: 'Linux runner to use for manual validation' + required: true + default: 'self-hosted' + type: 'choice' + options: + - 'self-hosted' + - 'hosted' concurrency: group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}' @@ -42,7 +50,7 @@ env: jobs: classify_pr: name: 'Classify PR' - if: "${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}" + if: "${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}" # Gate runs on ECS for in-repo PRs and for the merge queue (which runs in the # base-repo context), else a busy hosted pool delays it and blocks the # ECS-bound jobs. The kill-switch is read here, so flipping it reverts @@ -98,9 +106,14 @@ jobs: SAME_REPO: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' ECS_DISABLED: '${{ vars.MAINTAINER_ECS_RUNNER_DISABLED }}' EVENT_NAME: '${{ github.event_name }}' + DISPATCH_LINUX_RUNNER: '${{ github.event.inputs.linux_runner || '' }}' run: |- ubuntu_runner='["ubuntu-latest"]' - if [[ "${ECS_DISABLED}" != "true" && ( "${SAME_REPO}" == "true" || "${EVENT_NAME}" == "merge_group" ) ]]; then + if [[ "${EVENT_NAME}" == "workflow_dispatch" ]]; then + if [[ "${ECS_DISABLED}" != "true" && "${DISPATCH_LINUX_RUNNER}" == "self-hosted" ]]; then + ubuntu_runner='["self-hosted", "linux", "x64", "ecs-qwen"]' + fi + elif [[ "${ECS_DISABLED}" != "true" && ( "${SAME_REPO}" == "true" || "${EVENT_NAME}" == "merge_group" ) ]]; then ubuntu_runner='["self-hosted", "linux", "x64", "ecs-qwen"]' fi echo "ubuntu_runner=${ubuntu_runner}" >> "${GITHUB_OUTPUT}" @@ -373,7 +386,7 @@ jobs: if: |- ${{ !cancelled() && - github.event_name == 'pull_request' && + (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') && needs.classify_pr.outputs.skip_ci != 'true' && needs.test.outputs.ci_profile == 'full' }} @@ -385,10 +398,11 @@ jobs: - name: 'Checkout' uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2 with: - ref: "${{ format('refs/pull/{0}/head', github.event.pull_request.number) }}" + ref: "${{ github.event.inputs.branch_ref || (github.event_name == 'pull_request' && format('refs/pull/{0}/head', github.event.pull_request.number)) || github.ref }}" fetch-depth: 1 - name: 'Verify checkout includes expected head commit' + if: "${{ github.event_name == 'pull_request' }}" env: EXPECTED_SHA: '${{ github.event.pull_request.head.sha }}' run: |- From 0e105833c311354ab425d2142ff81a2d4752d4e1 Mon Sep 17 00:00:00 2001 From: yiliang114 Date: Tue, 14 Jul 2026 17:34:27 +0800 Subject: [PATCH 4/6] fix(ci): repair manual runner input parsing --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e509827ae4df..570e06fbdf73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: SAME_REPO: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' ECS_DISABLED: '${{ vars.MAINTAINER_ECS_RUNNER_DISABLED }}' EVENT_NAME: '${{ github.event_name }}' - DISPATCH_LINUX_RUNNER: '${{ github.event.inputs.linux_runner || '' }}' + DISPATCH_LINUX_RUNNER: '${{ github.event.inputs.linux_runner }}' run: |- ubuntu_runner='["ubuntu-latest"]' if [[ "${EVENT_NAME}" == "workflow_dispatch" ]]; then From c44f7dae19ace168d9d39a336b3d7c808ebeaaf0 Mon Sep 17 00:00:00 2001 From: yiliang114 Date: Tue, 14 Jul 2026 18:57:47 +0800 Subject: [PATCH 5/6] docs(ci): clarify self-hosted playwright deps --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 570e06fbdf73..3ebd2baa99f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -460,6 +460,7 @@ jobs: - name: 'Install Playwright Chromium (self-hosted)' if: "${{ runner.environment == 'self-hosted' }}" + # Self-hosted ECS runners already include system deps; --with-deps can race apt locks. run: 'npx playwright install chromium' - name: 'Choose web-shell Playwright port' From 7f84860226f44bfd4c426b7b7176194402777eb7 Mon Sep 17 00:00:00 2001 From: yiliang114 Date: Tue, 14 Jul 2026 19:57:28 +0800 Subject: [PATCH 6/6] test(ci): fix Playwright runner assertion --- scripts/tests/no-ak-integration-ci.test.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/tests/no-ak-integration-ci.test.js b/scripts/tests/no-ak-integration-ci.test.js index e84d9b976230..b2f37349941a 100644 --- a/scripts/tests/no-ak-integration-ci.test.js +++ b/scripts/tests/no-ak-integration-ci.test.js @@ -128,8 +128,7 @@ describe('no-AK integration CI wiring', () => { const webShellJob = getWorkflowJob(workflow, 'web_shell_e2e_smoke'); expect(webShellJob).toContain('ubuntu_runner'); - expect(webShellJob).toContain( - "if: \"${{ runner.environment == 'self-hosted' }}\"\n run: 'npx playwright install chromium'", - ); + expect(webShellJob).toContain("run: 'npx playwright install chromium'"); + expect(webShellJob).toContain('--with-deps chromium'); }); });