From 95a866bde17bb04f406b363626822a594e9e3882 Mon Sep 17 00:00:00 2001 From: ework-agent Date: Fri, 25 Sep 2026 12:31:45 +0800 Subject: [PATCH] ci: auto-trigger codex e2e on request-pipeline PRs (#1296 note-4 hardening) --- .github/workflows/ci-e2e.yml | 46 ++++++++++++++++++++++++++++++++++++ AGENTS.md | 10 +++++--- tests/e2e/README.md | 10 +++++--- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-e2e.yml b/.github/workflows/ci-e2e.yml index 0ecd3531f7..7cfee8e49b 100644 --- a/.github/workflows/ci-e2e.yml +++ b/.github/workflows/ci-e2e.yml @@ -7,32 +7,78 @@ on: description: "run forge phase (needs BILI_CODEX_COMPACT support in master)" type: boolean default: false + # #1296 note ④ hardening: routing/pipeline changes (#1284/#1290 class) got + # real-client coverage only when someone remembered to dispatch manually. + # Auto-run on request-pipeline hot files (AGENTS.md §E2E: server.ts, + # src/loop/, adapters, preflight/compact) instead. Everything else stays + # covered by the regular test/build workflows. + pull_request: + branches: [master] + paths: + - "src/server.ts" + - "src/server/**" + - "src/loop/**" + - "src/compress-loop*.ts" + - "src/stream*.ts" + - "src/persist.ts" + - "src/agent/**" + - "tests/e2e/**" + # acp-kernel is pinned exactly and bundled INLINE into the pipeline — + # a pin bump IS a pipeline change (#1289-class guard). + - "package-lock.json" + - ".github/workflows/ci-e2e.yml" + +# One run per ref: a fresh push cancels the superseded in-flight run — the +# suite spends real upstream tokens, never run it twice in parallel. +concurrency: + group: e2e-${{ github.ref }} + cancel-in-progress: true jobs: e2e: runs-on: ubuntu-latest timeout-minutes: 45 steps: + # Secrets are only injected for same-repo PRs and manual dispatch + # (fork PRs see none). Skip gracefully instead of failing red — + # the maintainer dispatches manually for fork contributions. + - name: Gate on E2E upstream secrets + env: + E2E_UPSTREAM_URL: ${{ secrets.E2E_UPSTREAM_URL }} + E2E_UPSTREAM_KEY: ${{ secrets.E2E_UPSTREAM_KEY }} + run: | + if [ -z "$E2E_UPSTREAM_URL" ] || [ -z "$E2E_UPSTREAM_KEY" ]; then + echo "::notice::E2E_UPSTREAM_URL / E2E_UPSTREAM_KEY unavailable for this event — skipping the real-client e2e run." + echo "E2E_SKIP=1" >> "$GITHUB_ENV" + fi - uses: actions/checkout@v4 + if: env.E2E_SKIP != '1' - uses: actions/setup-node@v4 + if: env.E2E_SKIP != '1' with: node-version: 22 # Pinned (#815): an unpinned @latest let a codex release change the # baseline system-prompt size and break the deterministic overflow phase. # Bump deliberately after re-running this suite locally on the new version. - name: Install codex CLI + if: env.E2E_SKIP != '1' run: npm install -g @openai/codex@0.147.0 - name: Print codex version + if: env.E2E_SKIP != '1' run: codex --version - run: npm ci + if: env.E2E_SKIP != '1' - run: npm run build + if: env.E2E_SKIP != '1' - name: Preflight + if: env.E2E_SKIP != '1' run: E2E_CHECK=1 node --import tsx --test tests/e2e/e2e-codex.test.ts env: E2E_UPSTREAM_URL: ${{ secrets.E2E_UPSTREAM_URL }} E2E_UPSTREAM_KEY: ${{ secrets.E2E_UPSTREAM_KEY }} - name: E2E suite + if: env.E2E_SKIP != '1' run: ACP_TEST_E2E=1 node --import tsx --test tests/e2e/e2e-codex.test.ts env: E2E_UPSTREAM_URL: ${{ secrets.E2E_UPSTREAM_URL }} diff --git a/AGENTS.md b/AGENTS.md index e0731fb8dd..827fa2e457 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -200,9 +200,13 @@ Rules: - Any Responses-compatible upstream works via `E2E_UPSTREAM_URL` / `E2E_UPSTREAM_KEY`; the provider is configured as `name = "OpenAI"` so codex stays on the remote compaction (V2) path — do not "fix" this. -- CI (`.github/workflows/ci-e2e.yml`) is manual-dispatch only and needs repo - secrets `E2E_UPSTREAM_URL` / `E2E_UPSTREAM_KEY`; a hosted runner cannot - reach `127.0.0.1` upstreams. +- CI (`.github/workflows/ci-e2e.yml`) auto-runs on PRs whose diff touches the + request-pipeline hot files (`src/server.ts`, `src/server/**`, `src/loop/**`, + `src/agent/**`, adapters/stream/persist, `tests/e2e/**`, `package-lock.json` + — an acp-kernel pin bump IS a pipeline change) plus manual dispatch for + anything else. It needs repo secrets `E2E_UPSTREAM_URL` / `E2E_UPSTREAM_KEY`; + a hosted runner cannot reach `127.0.0.1` upstreams, and events without + secret access (fork PRs) skip the run gracefully instead of failing. ### Code Quality diff --git a/tests/e2e/README.md b/tests/e2e/README.md index 5a964dfab0..079cd404b9 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -70,9 +70,13 @@ prints codex version, dist path, and an upstream `/models` probe. `.github/workflows/ci-e2e.yml` runs the suite on `workflow_dispatch` with `E2E_UPSTREAM_URL` / `E2E_UPSTREAM_KEY` from repository secrets, against the -repo's own `dist` (i.e. whatever is on master at dispatch time). The forge -phase is enabled via a repository variable `E2E_FORGE` so it can be turned on -once interception ships. +repo's own `dist` (i.e. whatever is on master at dispatch time). It also +auto-runs on PRs whose diff touches the request-pipeline hot files +(`src/server.ts`, `src/server/**`, `src/loop/**`, `src/agent/**`, adapters/ +stream/persist, `tests/e2e/**`, `package-lock.json`); events without secret +access (fork PRs) skip the run gracefully with a notice instead of failing. +The forge phase is enabled via the dispatch input `forge` (which sets the +`E2E_FORGE` env var) so it can be turned on once interception ships. ---