Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
ci: prepare core E2E browsers alongside web builds (#42706)
Stephen Zhou93c8b0fe1852
diff --git a/.github/actions/wait-e2e-web-build/action.yml b/.github/actions/wait-e2e-web-build/action.ymlnew file mode 100644index 00000000000..6d06a0f4095--- /dev/null+++ b/.github/actions/wait-e2e-web-build/action.yml@@ -0,0 +1,21 @@+name: Wait for Core E2E Web Build+description: Wait for the current workflow run's Web build artifact while the producer finishes independently++outputs:+ artifact-id:+ description: ID of the ready Web build artifact+ value: ${{ steps.wait.outputs.result }}++runs:+ using: composite+ steps:+ - name: Wait for build artifact+ id: wait+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0+ env:+ E2E_WAIT_ACTION_PATH: ${{ github.action_path }}+ with:+ result-encoding: string+ script: |+ const waitForBuild = require(`${process.env.E2E_WAIT_ACTION_PATH}/wait.cjs`)+ return await waitForBuild({ github, context, core, runAttempt: Number(process.env.GITHUB_RUN_ATTEMPT) })diff --git a/.github/actions/wait-e2e-web-build/wait.cjs b/.github/actions/wait-e2e-web-build/wait.cjsnew file mode 100644index 00000000000..5eabe5c574d--- /dev/null+++ b/.github/actions/wait-e2e-web-build/wait.cjs@@ -0,0 +1,65 @@+const { setTimeout: delay } = require('node:timers/promises')++module.exports = async function waitForBuild({+ github,+ context,+ core,+ runAttempt,+ now = Date.now,+ sleep = delay,+ timeoutMs = 30 * 60 * 1000,+}) {+ const started = now()+ const run = { ...context.repo, run_id: context.runId, per_page: 100 }+ core.info('Waiting for core-e2e-web-build in this workflow run')++ while (now() - started < timeoutMs) {+ const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRunAttempt, {+ ...run,+ attempt_number: runAttempt,+ })+ const producer = jobs.find(+ (job) =>+ job.name === 'Prepare Core E2E Web Build' ||+ job.name.endsWith(' / Prepare Core E2E Web Build'),+ )+ if (producer?.status === 'completed' && producer.conclusion !== 'success') {+ throw new Error(+ `Web build finished with ${producer.conclusion} before publishing an artifact`,+ )+ }++ if (producer && ['in_progress', 'completed'].includes(producer.status)) {+ const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, run)+ const upload = producer.steps?.find((step) => step.name === 'Upload Web build')+ const artifact = artifacts.find((item) => {+ if (item.expired || !/^core-e2e-web-build-[1-9]\d*$/.test(item.name)) return false+ if (producer.status === 'in_progress') {+ // A rebuilding producer must publish this attempt's immutable artifact.+ return item.name === `core-e2e-web-build-${runAttempt}`+ }+ // GitHub relabels reused successful jobs with the current run_attempt.+ // Their upload step keeps its original timestamps, identifying the artifact+ // to reuse when only consumers are rerun (including across several attempts).+ return (+ upload?.conclusion === 'success' &&+ item.created_at >= upload.started_at &&+ item.created_at <= upload.completed_at+ )+ })+ if (artifact) {+ const seconds = Math.round((now() - started) / 1000)+ core.info(`Web build artifact ${artifact.name} ready after ${seconds}s`)+ await core.summary+ .addHeading('E2E Web build wait')+ .addRaw(`Artifact wait: ${seconds}s`)+ .write()+ return String(artifact.id)+ }+ }++ await sleep(Math.min(10000, timeoutMs - (now() - started)))+ }++ throw new Error('Timed out waiting for core-e2e-web-build in this workflow run')+}diff --git a/.github/actions/wait-e2e-web-build/wait.test.cjs b/.github/actions/wait-e2e-web-build/wait.test.cjsnew file mode 100644index 00000000000..b8f58b69e7e--- /dev/null+++ b/.github/actions/wait-e2e-web-build/wait.test.cjs@@ -0,0 +1,164 @@+const assert = require('node:assert/strict')+const { test } = require('node:test')+const waitForBuild = require('./wait.cjs')++function fixture({ artifacts = [], jobs = [producer], error, runAttempt = 2 } = {}) {+ let elapsed = 0+ const calls = []+ const summary = {+ addHeading() {+ return this+ },+ addRaw() {+ return this+ },+ async write() {},+ }+ return {+ calls,+ options: {+ context: { repo: { owner: 'owner', repo: 'repo' }, runId: 123 },+ core: { info() {}, summary },+ runAttempt,+ github: {+ rest: {+ actions: { listWorkflowRunArtifacts: 'artifacts', listJobsForWorkflowRunAttempt: 'jobs' },+ },+ async paginate(endpoint, params) {+ calls.push({ endpoint, params })+ if (error) throw error+ const values = endpoint === 'artifacts' ? artifacts : jobs+ return typeof values === 'function' ? values(elapsed) : values+ },+ },+ now: () => elapsed,+ sleep: async (ms) => {+ elapsed += ms+ },+ timeoutMs: 20000,+ },+ }+}++const producer = {+ name: 'Run Web Full-Stack E2E / Prepare Core E2E Web Build',+ status: 'in_progress',+ run_attempt: 2,+}+const artifact = {+ id: 42,+ name: 'core-e2e-web-build-2',+ expired: false,+ created_at: '2026-09-22T04:08:11Z',+}+const oldArtifact = {+ ...artifact,+ id: 41,+ name: 'core-e2e-web-build-1',+ created_at: '2026-09-22T03:08:11Z',+}+const successfulProducer = {+ ...producer,+ status: 'completed',+ conclusion: 'success',+ steps: [+ {+ name: 'Upload Web build',+ conclusion: 'success',+ started_at: '2026-09-22T04:08:08Z',+ completed_at: '2026-09-22T04:08:12Z',+ },+ ],+}++test('starts consuming the current artifact without waiting for producer cache saves', async () => {+ const { options, calls } = fixture({ artifacts: (elapsed) => (elapsed ? [artifact] : []) })+ assert.equal(await waitForBuild(options), '42')+ assert.equal(options.now(), 10000)+ assert.deepEqual(+ calls.map((call) => call.endpoint),+ ['jobs', 'artifacts', 'jobs', 'artifacts'],+ )+ for (const { endpoint, params } of calls) {+ assert.equal(params.run_id, 123)+ assert.equal(params.owner, 'owner')+ assert.equal(params.repo, 'repo')+ if (endpoint === 'jobs') assert.equal(params.attempt_number, 2)+ }+})++test('full reruns ignore the old artifact until the rebuilding producer publishes this attempt', async () => {+ const { options } = fixture({+ artifacts: (elapsed) => (elapsed ? [oldArtifact, artifact] : [oldArtifact]),+ })+ assert.equal(await waitForBuild(options), '42')+ assert.equal(options.now(), 10000)+})++test('does not use an old artifact before the current producer appears or while it is queued', async () => {+ const { options } = fixture({+ artifacts: [oldArtifact],+ jobs: (elapsed) => (elapsed ? [{ ...producer, status: 'queued' }] : []),+ })+ await assert.rejects(waitForBuild(options), /Timed out/)+})++test('consumer-only reruns reuse the actual successful upload despite a relabeled run_attempt', async () => {+ const { options } = fixture({+ runAttempt: 4,+ artifacts: [oldArtifact, artifact],+ jobs: [{ ...successfulProducer, run_attempt: 4 }],+ })+ assert.equal(await waitForBuild(options), '42')+ assert.equal(options.now(), 0)+})++for (const conclusion of ['failure', 'cancelled', 'skipped']) {+ test(`does not fall back to an old artifact when the producer finishes with ${conclusion}`, async () => {+ const { options } = fixture({+ artifacts: [oldArtifact, artifact],+ jobs: [{ ...producer, status: 'completed', conclusion }],+ })+ await assert.rejects(waitForBuild(options), new RegExp(`Web build finished with ${conclusion}`))+ assert.equal(options.now(), 0)+ })+}++test('ignores unrelated and expired artifacts and stops at the deadline', async () => {+ const { options } = fixture({+ artifacts: [+ { ...artifact, expired: true },+ { ...artifact, name: 'other' },+ ],+ })+ await assert.rejects(waitForBuild(options), /Timed out/)+ assert.equal(options.now(), 20000)+})++test('completed rebuilt producers select their upload instead of the old artifact', async () => {+ const { options } = fixture({ artifacts: [oldArtifact, artifact], jobs: [successfulProducer] })+ assert.equal(await waitForBuild(options), '42')+})++test('allows artifact visibility to catch up after a successful producer finishes', async () => {+ const { options } = fixture({+ artifacts: (elapsed) => (elapsed ? [oldArtifact, artifact] : [oldArtifact]),+ jobs: [successfulProducer],+ })+ assert.equal(await waitForBuild(options), '42')+ assert.equal(options.now(), 10000)+})++test('does not reuse artifacts without a successful matching upload step', async () => {+ const { options } = fixture({+ artifacts: [artifact],+ jobs: [{ ...successfulProducer, steps: [] }],+ })+ await assert.rejects(waitForBuild(options), /Timed out/)+})++test('reports API errors rather than silently waiting until timeout', async () => {+ const { options } = fixture({ error: new Error('Resource not accessible by integration') })+ await assert.rejects(waitForBuild(options), /Resource not accessible/)+ assert.equal(options.now(), 0)+})diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.ymlindex 902d8f23b28..0cb39cde45c 100644--- a/.github/workflows/main-ci.yml+++ b/.github/workflows/main-ci.yml@@ -112,6 +112,7 @@ jobs:- '.github/workflows/main-ci.yml'- '.github/actions/setup-web/**'- '.github/actions/setup-core-e2e/**'+ - '.github/actions/wait-e2e-web-build/**'vdb:- 'api/core/rag/datasource/**'- 'api/tests/integration_tests/vdb/**'diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.ymlindex b84461ce3b4..bb2deed6450 100644--- a/.github/workflows/post-merge.yml+++ b/.github/workflows/post-merge.yml@@ -114,6 +114,9 @@ jobs:name: External Runtime E2Eneeds: check-changesif: needs.check-changes.outputs.external-e2e-changed == 'true'+ permissions:+ actions: read+ contents: readuses: ./.github/workflows/web-e2e.ymlwith:run-external-runtime: truediff --git a/.github/workflows/web-e2e.yml b/.github/workflows/web-e2e.ymlindex 84dbe9605f3..3455f990689 100644--- a/.github/workflows/web-e2e.yml+++ b/.github/workflows/web-e2e.yml@@ -9,6 +9,7 @@ on:type: booleanpermissions:+ actions: readcontents: readjobs:@@ -24,6 +25,9 @@ jobs:with:persist-credentials: false+ - name: Test Web build synchronization+ run: node --test .github/actions/wait-e2e-web-build/wait.test.cjs+- name: Compute build source hashid: build-sourceshell: bash@@ -35,7 +39,7 @@ jobs:- name: Setup web dependenciesuses: ./.github/actions/setup-webwith:- # Browser jobs wait for this job, including its post-action cache saves.+ # Browser jobs already save this dependency cache; avoid duplicate uploads.cache-save: 'false'- name: Restore Next.js build cache@@ -76,10 +80,9 @@ jobs:- name: Upload Web builduses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1with:- name: core-e2e-web-build+ name: core-e2e-web-build-${{ github.run_attempt }}path: e2e-web-build.tarif-no-files-found: error- overwrite: trueretention-days: 7- name: Save Next.js build cache@@ -92,7 +95,6 @@ jobs:chromium-full:name: Chromium Full (${{ matrix.shard }}/3)if: ${{ !inputs.run-external-runtime }}- needs: core-buildruns-on: ubuntu-24.04timeout-minutes: 45strategy:@@ -117,10 +119,17 @@ jobs:with:browser: chromium+ # Install dependencies while core-build runs, then wait only for its artifact.+ - name: Wait for Web build+ id: web-build+ timeout-minutes: 35+ uses: ./.github/actions/wait-e2e-web-build+- name: Download Web builduses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1with:- name: core-e2e-web-build+ artifact-ids: ${{ steps.web-build.outputs.artifact-id }}+ github-token: ${{ github.token }}- name: Extract Web buildrun: tar -xf e2e-web-build.tar -C web@@ -153,9 +162,8 @@ jobs:webkit-smoke:name: WebKit Browser Smokeif: ${{ !inputs.run-external-runtime }}- needs: core-buildruns-on: ubuntu-24.04- timeout-minutes: 30+ timeout-minutes: 45env:E2E_ADMIN_EMAIL: [email protected]E2E_ADMIN_NAME: E2E Admin@@ -175,10 +183,17 @@ jobs:with:browser: webkit+ # Install dependencies while core-build runs, then wait only for its artifact.+ - name: Wait for Web build+ id: web-build+ timeout-minutes: 35+ uses: ./.github/actions/wait-e2e-web-build+- name: Download Web builduses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1with:- name: core-e2e-web-build+ artifact-ids: ${{ steps.web-build.outputs.artifact-id }}+ github-token: ${{ github.token }}- name: Extract Web buildrun: tar -xf e2e-web-build.tar -C web