Skip to content

πŸ™Œ OpenHands: AI-Driven Development

ci: run mock-LLM E2E tests on every PR commit (#1207)

Rohit Malhotra935603a62131
diff --git a/.github/workflows/mock-llm-docker-e2e.yml b/.github/workflows/mock-llm-docker-e2e.yml
index 2479dcffe7..eab35b9734 100644
--- a/.github/workflows/mock-llm-docker-e2e.yml
+++ b/.github/workflows/mock-llm-docker-e2e.yml
@@ -6,10 +6,11 @@ name: Mock-LLM Docker E2E Tests
# Trigger chain:
# 1. workflow_run β€” fires automatically after the "Docker" workflow
# completes on main. The image is already built/pushed to GHCR.
-# 2. pull_request β€” fires on PRs with the 'e2e-tests' label. Waits for
-# the Docker workflow to finish, then pulls the image from GHCR.
-# (workflow_run doesn't fire for new workflow files until they're on
-# the default branch, so pull_request is needed for first-run PRs.)
+# 2. pull_request β€” fires on every PR commit. Waits for the Docker
+# workflow to finish, then pulls the image from GHCR. Fork PRs are
+# skipped (no GHCR push). (workflow_run doesn't fire for new workflow
+# files until they're on the default branch, so pull_request is
+# needed for first-run PRs.)
# 3. workflow_dispatch β€” manual trigger with a custom image tag.
on:
@@ -17,7 +18,7 @@ on:
workflows: ["Docker"]
types: [completed]
pull_request:
- types: [opened, synchronize, reopened, labeled]
+ types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
docker_image:
@@ -49,9 +50,9 @@ jobs:
mock-llm-docker-e2e:
# workflow_run: only for main/master β€” validates the published image.
# PR branches are already covered by the pull_request trigger below;
- # without this guard, both triggers fire for e2e-tests PRs, producing
+ # without this guard, both triggers fire for PRs, producing
# duplicate (and potentially contradictory) comment pairs.
- # pull_request: only run with the 'e2e-tests' label, skip fork PRs (no GHCR push).
+ # pull_request: skip fork PRs (no GHCR push).
# workflow_dispatch: always run.
if: >-
github.event_name == 'workflow_dispatch' ||
@@ -60,7 +61,6 @@ jobs:
(github.event.workflow_run.head_branch == 'main' ||
github.event.workflow_run.head_branch == 'master')) ||
(github.event_name == 'pull_request' &&
- contains(github.event.pull_request.labels.*.name, 'e2e-tests') &&
!github.event.pull_request.head.repo.fork)
runs-on: ubuntu-24.04
timeout-minutes: 15
diff --git a/.github/workflows/mock-llm-e2e.yml b/.github/workflows/mock-llm-e2e.yml
index 2361b7ce93..afda220607 100644
--- a/.github/workflows/mock-llm-e2e.yml
+++ b/.github/workflows/mock-llm-e2e.yml
@@ -2,7 +2,7 @@ name: Mock-LLM E2E Tests
on:
pull_request:
- types: [opened, synchronize, reopened, labeled, unlabeled]
+ types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
@@ -15,11 +15,6 @@ permissions:
jobs:
mock-llm-e2e:
- # Run when the PR has the 'e2e-tests' label, or on manual dispatch.
- if: >-
- github.event_name == 'workflow_dispatch' ||
- (github.event_name == 'pull_request' &&
- contains(github.event.pull_request.labels.*.name, 'e2e-tests'))
runs-on: ubuntu-24.04
timeout-minutes: 15
diff --git a/AGENTS.md b/AGENTS.md
index 8d450c771d..1f0308d3f5 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -197,7 +197,7 @@ you are running inside of β€” NOT the automation backend.
- `mock-llm-partial-stack.spec.ts` β€” Partial stack mode tests. Unlike other specs, these spawn their own `bin/agent-canvas.mjs` child processes instead of relying on the config's webServer entries. Three describe blocks: (1) `--frontend-only` verifies static frontend is served (200 on `/`), backend routes return 503 (`/server_info`, `/api/settings`, `/api/automation/v1`), and the browser shows the manage-backends modal; (2) `--backend-only` verifies `/server_info` returns 200, `/api/settings` is reachable, automation endpoint works, and root/asset requests return 503; (3) port conflict verifies the process exits non-zero with a clear error message when the ingress port is occupied, then starts successfully on a free port. Each test uses isolated state dirs and high port numbers (18310+ range) to avoid collisions with the main full-stack instance.
- `mock-llm-ui-regressions.spec.ts` β€” UI regression tests (CSS isolation scoping, event pagination on scroll-up, workspace selection persistence). Uses `page.route()` to intercept specific API responses where deterministic mock data is needed. Consolidated from the former `tests/e2e/regressions/` directory (which was never wired into CI).
- Tests run serially (`workers: 1`, `mode: "serial"` per describe block). Files are discovered alphabetically so the ACP agent test runs first, followed by auth-modes, automation, conversation, etc.; each spec is self-contained (automation test configures its own LLM profile via the settings API, ACP test resets back to OpenHands agent in afterAll). The `afterEach` hook resets the mock LLM to its default trajectory so subsequent specs start fresh even when a preceding test fails.
-- CI workflow: `.github/workflows/mock-llm-e2e.yml` runs on PRs with the `e2e-tests` label or on manual dispatch. It builds the frontend, starts the mock LLM server, runs the tests, and posts a PR comment with results.
+- CI workflow: `.github/workflows/mock-llm-e2e.yml` runs on every PR commit (opened, synchronize, reopened) and on manual dispatch. It builds the frontend, starts the mock LLM server, runs the tests, and posts a PR comment with results.
- The custom `DoneMarkerReporter` writes `.mock-llm-markers/.tests-done` after all tests complete (before webServer teardown) so the CI wrapper can detect completion and kill the lingering teardown process.
### Docker Image Testing (Shared Specs)
@@ -211,7 +211,7 @@ you are running inside of β€” NOT the automation backend.
- `MOCK_LLM_AGENT_URL` β€” defaults to `MOCK_LLM_BASE_URL`, overridable via `MOCK_LLM_AGENT_URL` env var. Used when configuring the LLM profile (`base_url` field) β€” this is the URL the agent-server uses for inference calls. The npm path and Docker-with-`--network host` path use the same value; Docker on macOS needs the override.
- **Docker image**: Set `MOCK_LLM_DOCKER_IMAGE` to the image tag (default: `ghcr.io/openhands/agent-canvas:latest`). The container is started with `--rm --network host` and a unique `--name` for cleanup.
- **State isolation**: The Docker container uses its internal state directory (no host mount needed for tests). Each test run starts a fresh container.
-- CI workflow: `.github/workflows/mock-llm-docker-e2e.yml` has three triggers β€” all pull the already-built image from GHCR (no rebuild): (1) `workflow_run` fires automatically after the `Docker` workflow completes on main; (2) `pull_request` with the `e2e-tests` label polls the Docker workflow until it finishes for the PR's head SHA, then pulls the image (needed because `workflow_run` only fires for workflow files already on the default branch); (3) `workflow_dispatch` accepts a custom `docker_image` input. The image tag is derived from the commit SHA (`ghcr.io/openhands/agent-canvas:sha-<short>-amd64`). Fork PRs are skipped (no GHCR push). Report artifacts go to `test-results-mock-llm-docker/` and `playwright-report-mock-llm-docker/`.
+- CI workflow: `.github/workflows/mock-llm-docker-e2e.yml` has three triggers β€” all pull the already-built image from GHCR (no rebuild): (1) `workflow_run` fires automatically after the `Docker` workflow completes on main; (2) `pull_request` fires on every PR commit (opened, synchronize, reopened), polls the Docker workflow until it finishes for the PR's head SHA, then pulls the image (needed because `workflow_run` only fires for workflow files already on the default branch); (3) `workflow_dispatch` accepts a custom `docker_image` input. The image tag is derived from the commit SHA (`ghcr.io/openhands/agent-canvas:sha-<short>-amd64`). Fork PRs are skipped (no GHCR push). Report artifacts go to `test-results-mock-llm-docker/` and `playwright-report-mock-llm-docker/`.
## Debugging E2E Test Failures