Skip to content

ci(web-e2e): cache Playwright browsers + timeout/retry the install (fixes #1167)#1306

Merged
mabry1985 merged 1 commit into
mainfrom
fix/ci-playwright-install-flake
Jun 22, 2026
Merged

ci(web-e2e): cache Playwright browsers + timeout/retry the install (fixes #1167)#1306
mabry1985 merged 1 commit into
mainfrom
fix/ci-playwright-install-flake

Conversation

@mabry1985

@mabry1985 mabry1985 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Closes #1167.

The Web E2E smoke job ran playwright install --with-deps chromium on every run with no cache, no timeout, and no retry — so a stalled CDN download for the ~100MB chromium binary hung the step ~10 min until the job-level orphan-kill fired (Terminate orphan process … playwright install). A recurring false-red that masked real E2E signal and cost a manual gh run rerun --failed each hit (recurred on #1158/#1161/#1164 this week).

Fix (stacks suggestions 1 + 2 from the issue)

  • Cache ~/.cache/ms-playwright keyed on the resolved Playwright version (@playwright/test 1.60.0). On a cache hit the slow binary download is skipped entirely — only the fast apt system-deps run (playwright install-deps chromium).
  • Timeout + retry: each attempt is hard-capped with timeout 240 and retried up to 3×, so a stalled download fails fast and self-heals instead of hanging to the ~10 min orphan-kill. Step capped at timeout-minutes: 8.

Verification

YAML validated locally. The behavior is CI-only — this PR's own run is the first exercise: it's a cache miss (full --with-deps install, populates the cache), and subsequent runs on the same Playwright version hit the cache. No app code touched.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced end-to-end testing pipeline with optimized browser installation, caching mechanisms, and improved error recovery to ensure faster and more reliable test execution.

…ixes #1167)

The Web E2E smoke job ran `playwright install --with-deps chromium` on every run
with no cache, no timeout, and no retry — so a stalled CDN download for the ~100MB
chromium binary hung the step ~10min until the job-level orphan-kill fired, a
recurring false-red that cost a manual `gh run rerun --failed` each hit.

- Cache `~/.cache/ms-playwright` keyed on the resolved Playwright version; on a hit
  skip the binary download and run only the fast apt system-deps (`install-deps`).
- Hard-cap each attempt with `timeout 240` and retry up to 3× so a stalled download
  fails fast and self-heals instead of hanging to the orphan-kill; step capped at
  `timeout-minutes: 8`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@protoquinn

protoquinn Bot commented Jun 22, 2026

Copy link
Copy Markdown

👀 Quinn is reviewing — verdict (PASS / WARN / FAIL) + findings to follow.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The web-e2e CI job's Playwright Chromium install step is replaced with a multi-step approach: the @playwright/test version is resolved at runtime, the browser cache directory (~/.cache/ms-playwright) is stored and restored keyed by that version, and the install command is selected based on cache hit or miss. The install is wrapped in a 240-second timeout with up to three retry attempts before hard-failing.

Changes

Playwright CI Install Hardening

Layer / File(s) Summary
Playwright version resolution, caching, and retried install
.github/workflows/checks.yml
Replaces the single playwright install --with-deps chromium step with steps that resolve the Playwright version, cache ~/.cache/ms-playwright keyed by that version, conditionally run install-deps on cache hit or install --with-deps on cache miss, and wrap each attempt in a 240s timeout with 3 retries, hard-failing after exhaustion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding Playwright browser caching and timeout/retry logic to the CI workflow, and explicitly references the issue it fixes.
Description check ✅ Passed The description includes a clear summary of the problem and solution, explicitly closes issue #1167, and explains the verification approach, though a formal test plan checklist is missing.
Linked Issues check ✅ Passed The PR implements the two primary objectives from issue #1167: caching the Playwright browser directory keyed on version, and adding timeout/retry logic to prevent hangs and enable self-healing.
Out of Scope Changes check ✅ Passed All changes are within scope—the modification to the workflow file directly addresses the caching, timeout, and retry mechanisms specified in issue #1167 with no extraneous changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-playwright-install-flake

Comment @coderabbitai help to get the list of available commands and usage tips.

@protoquinn protoquinn Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Audit — PR #1306 | ci(web-e2e): cache Playwright browsers + timeout/retry the install (fixes #1167)

VERDICT: WARN (non-blocking — CI not yet terminal)


CI Status

  • No check runs registered yet for head db210c1. Likely queued — this is a Gap, not a failure.

Diff Review

  • Single file: .github/workflows/checks.yml — no app code touched.
  • Replaces bare playwright install --with-deps chromium with version-keyed cache (actions/cache@v4) + timeout/retry loop (3×, 240s cap, 8-min step limit).
  • Cache-hit path correctly skips binary download and runs apt system-deps only.

Observations

  • GAP: CI checks not yet visible to reviewer — re-review after checks complete to confirm the workflow exercises the new code path.
  • LOW: clawpatch structural review skipped (repo not in project registry) — diff is single-file and CI-only, low risk.
  • The node -p "require('@playwright/test/package.json').version" resolution from repo root relies on npm workspace hoisting — reliable on this project, no concern.

— Quinn, QA Engineer

@protoquinn

protoquinn Bot commented Jun 22, 2026

Copy link
Copy Markdown

Submitted COMMENT review on protoLabsAI/protoAgent#1306.

@protoquinn protoquinn Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI terminal-green, no blockers on prior review — auto-approving on green (#748).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/checks.yml:
- Line 169: The timeout-minutes value of 8 is insufficient to allow all retry
attempts to complete. In the checks.yml workflow file, increase the
timeout-minutes value from 8 to at least 15 to accommodate the worst-case
scenario of 3 retry attempts at 240 seconds each plus sleep intervals between
retries. This ensures the step timeout does not prematurely terminate before all
retry attempts and the explicit error handling can execute properly.
- Line 159: In the GitHub Actions workflow checks file, the `actions/cache@v4`
action reference at the specified location uses a mutable tag instead of a
pinned commit hash. Visit the actions/cache releases page to find the latest v4
release commit hash, then update the `uses: actions/cache@v4` line to reference
the specific commit hash in the format `uses: actions/cache@<commit-hash>` to
ensure supply-chain security and prevent the action from being modified by
upstream changes or potential attacks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 49304ae3-fc8c-4493-be14-9d244b095742

📥 Commits

Reviewing files that changed from the base of the PR and between d0026aa and db210c1.

📒 Files selected for processing (1)
  • .github/workflows/checks.yml

run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
id: pw-cache
uses: actions/cache@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin the cache action to a commit hash for supply-chain security.

The actions/cache@v4 reference should be pinned to a specific commit hash rather than a mutable tag, per the blanket policy flagged by static analysis. Mutable tags can be modified by attackers who compromise the upstream action repository.

🔒 Proposed fix to pin the action

Visit the actions/cache releases page to find the latest v4 commit hash, then update:

-      uses: actions/cache@v4
+      uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9  # v4.2.0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: actions/cache@v4
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.2.0
🧰 Tools
🪛 zizmor (1.26.1)

[error] 159-159: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/checks.yml at line 159, In the GitHub Actions workflow
checks file, the `actions/cache@v4` action reference at the specified location
uses a mutable tag instead of a pinned commit hash. Visit the actions/cache
releases page to find the latest v4 release commit hash, then update the `uses:
actions/cache@v4` line to reference the specific commit hash in the format
`uses: actions/cache@<commit-hash>` to ensure supply-chain security and prevent
the action from being modified by upstream changes or potential attacks.

Source: Linters/SAST tools

# on the Playwright version (skips the download entirely on a hit — only the
# fast apt system-deps run then), and hard-cap each attempt with `timeout` so
# a stalled download fails fast and retries instead of hanging the whole job.
timeout-minutes: 8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Increase the step timeout to allow all retry attempts to complete.

The step timeout of 8 minutes (480 seconds) is insufficient to accommodate 3 full retry attempts:

  • Worst case: 3 attempts × 240s + 2 sleeps × 5s = 730 seconds (~12.2 minutes)
  • Current step timeout: 8 minutes = 480 seconds

The step timeout will fire before all retries can complete, causing the workflow to fail mid-retry without reaching the explicit error message on line 183. This defeats the self-healing retry mechanism.

⏱️ Proposed fix to prevent premature timeout
-      timeout-minutes: 8
+      timeout-minutes: 15

This allows all 3 attempts to complete with buffer for system overhead.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
timeout-minutes: 8
timeout-minutes: 15
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/checks.yml at line 169, The timeout-minutes value of 8 is
insufficient to allow all retry attempts to complete. In the checks.yml workflow
file, increase the timeout-minutes value from 8 to at least 15 to accommodate
the worst-case scenario of 3 retry attempts at 240 seconds each plus sleep
intervals between retries. This ensures the step timeout does not prematurely
terminate before all retry attempts and the explicit error handling can execute
properly.

@mabry1985
mabry1985 merged commit 824e492 into main Jun 22, 2026
7 checks passed
@mabry1985
mabry1985 deleted the fix/ci-playwright-install-flake branch June 22, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI flake: Web E2E smoke — 'playwright install --with-deps chromium' hangs ~10min then is killed

1 participant