Skip to content

Improve Playwright CLI guidance and browser provisioning - #57731

Merged
pelikhan merged 13 commits into
mainfrom
copilot/improve-playwright-workflow-guidance
Sep 1, 2026
Merged

Improve Playwright CLI guidance and browser provisioning#57731
pelikhan merged 13 commits into
mainfrom
copilot/improve-playwright-workflow-guidance

Conversation

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Playwright guidance now matches the current @playwright/cli interface and explicitly defines browser, loopback, artifact, accessibility, and diagnostic behavior in AWF.

  • Provisioning

    • Provision Chromium, Firefox, and WebKit before the agent starts.
    • Keep browser/package installation prohibited during agent execution.
  • Workflow guidance

    • Document automatic playwright-cli:* access for restricted Bash allowlists.
    • Clarify that same-sandbox loopback does not require network.allowed: local.
    • Document named sessions, ephemeral /tmp files, accessibility boundaries, and diagnostics.
  • Public reference

    • Replace obsolete MCP-style CLI examples with open, snapshot, resize, and screenshot.
    • Add a safe-output example for publishing screenshots.
safe-outputs:
  upload-artifact:
    allowed-paths: ["/tmp/*.png"]
    max-uploads: 1
    retention-days: 7
  • Compiler coverage
    • Extend Playwright compiler fixtures to verify browser provisioning, automatic restricted-Bash permission, and loopback usage without local.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 19.5 AIC · ⌖ 8.76 AIC · ⊞ 8.9K ·
Comment /souschef to run again

Copilot AI and others added 2 commits September 1, 2026 16:28
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve Playwright workflow guidance and reconcile CLI examples Improve Playwright CLI guidance and browser provisioning Sep 1, 2026
Copilot AI requested a review from lpcox September 1, 2026 16:28
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Great work! 🎉 This PR looks ready for review. You've done a thorough job updating the Playwright CLI guidance to match the current @playwright/cli interface, with comprehensive coverage including browser provisioning, loopback behavior, safe-output examples, and compiler fixtures. The changes are focused and well-tested, with good documentation updates and test coverage. Excellent contribution to the Playwright workflow guidance! 👍

Generated by ✅ Contribution Check · copilot · auto · 46.5 AIC · ⌖ 7.92 AIC · ⊞ 9.3K ·

@lpcox
lpcox marked this pull request as ready for review September 1, 2026 17:19
Copilot AI balanced review requested due to automatic review settings September 1, 2026 17:19
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer failed during the skills-based review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Ponytail Reviewer. Review the logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by Ponytail Reviewer for #57731

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-09-01T17:25:54.984+00:00
review_event: REQUEST_CHANGES
top_themes:
  - unverified playwright browser provisioning command in compiler/runtime contract
files_reviewed:
  - .github/aw/actions-lock.json
  - .github/aw/network.md
  - .github/aw/playwright.md
  - docs/src/content/docs/reference/playwright.md
  - pkg/workflow/playwright_cli.go
  - pkg/workflow/playwright_cli_test.go
  - pkg/workflow/testdata/TestWasmGolden_CompileFixtures/playwright-cli-mode.golden
  - pkg/workflow/testdata/wasm_golden/WasmBinary/playwright-cli-mode.golden
  - pkg/workflow/testdata/wasm_golden/fixtures/playwright-cli-mode.md
comment_count: 0

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 34.3 AIC · ⌖ 7.34 AIC · ⊞ 21.8K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict

REQUEST_CHANGES — the documentation update is fine, but the compiler change hard-codes three playwright-cli install-browser steps into every Playwright-enabled job and there is no evidence those commands exist in the pinned CLI/runtime combination.

Blocking themes
  • The implementation assumes a browser-install subcommand/API without any compatibility guard or version-gated test against the actual pinned @playwright/cli behavior.
  • The new guidance tells users browsers are pre-provisioned, so if those install steps fail at runtime the entire workflow breaks before the agent starts.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 34.3 AIC · ⌖ 7.34 AIC · ⊞ 21.8K
Comment /review to run again

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

ADR required before merge

I enforced the design-decision gate for this PR because it adds 243 new lines in business-logic directories (pkg/), which exceeds the default 100-line threshold.

Evidence reviewed

  • PR body: documents new Playwright CLI behavior, browser provisioning, loopback guidance, and compiler coverage
  • Diff: pkg/workflow/playwright_cli.go now installs Chromium, Firefox, and WebKit before the agent starts
  • Diff: docs and golden fixtures standardize playwright-cli usage, automatic playwright-cli:* allowlisting, and localhost behavior without network.allowed: local
  • Existing ADRs on branch: latest related ADR is docs/adr/57521-remove-built-in-playwright-mcp-support.md, but it does not cover this new pre-provisioning and workflow-guidance decision

Action taken

I added a draft ADR at docs/adr/57731-standardize-playwright-cli-provisioning-and-loopback-guidance.md.

Next action for the author

Review and refine that ADR with any missing rationale, then keep it with the PR as the decision record for this implementation.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · gpt54 · 17.3 AIC · ⌖ 11 AIC · ⊞ 9.9K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pkg/workflow/playwright_cli.go:114: shrink: helper plus browser-name list for three fixed browser installs. Inline the three step literals and drop the abstraction.

net: -10 lines possible.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by ✂️ Ponytail Reviewer for #57731 · codex · mai10 · 4.53 AIC · ⌖ 0.322 AIC · ⊞ 13.5K
Comment /ponytail to run again

Comment thread pkg/workflow/playwright_cli.go Outdated
return steps
}

func generatePlaywrightBrowserInstallSteps() []GitHubActionStep {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pkg/workflow/playwright_cli.go:114: shrink: helper plus browser-name list for three fixed browser installs. Inline the three step literals and drop the abstraction.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The browser install steps now use explicit literals, while each step sets the pinned CLI's supported PLAYWRIGHT_BROWSERS_PATH; regenerated lock files include the same commands and environment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Host-side browser downloads are not made available inside the AWF sandbox, and current tests do not detect that failure.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates Playwright CLI provisioning and guidance for browser support, sandbox networking, artifacts, accessibility, and diagnostics.

Changes:

  • Provisions Chromium, Firefox, and WebKit before agent execution.
  • Updates Playwright documentation and CLI examples.
  • Extends compiler fixtures for loopback access and restricted Bash permissions.
File summaries
File Description
pkg/workflow/playwright_cli.go Adds browser provisioning steps.
pkg/workflow/playwright_cli_test.go Tests generated provisioning commands.
pkg/workflow/testdata/wasm_golden/fixtures/playwright-cli-mode.md Exercises loopback and restricted Bash.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/playwright-cli-mode.golden Updates canonical compiled output.
pkg/workflow/testdata/wasm_golden/WasmBinary/playwright-cli-mode.golden Updates WASM output snapshot.
docs/src/content/docs/reference/playwright.md Revises public Playwright reference.
.github/aw/playwright.md Expands internal workflow guidance.
.github/aw/network.md Clarifies loopback behavior.
.github/aw/actions-lock.json Adds a checkout action pin.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread pkg/workflow/playwright_cli.go Outdated
for _, browser := range playwrightBrowserNames {
steps = append(steps, GitHubActionStep{
" - name: Install Playwright " + browser + " browser",
" run: playwright-cli install-browser " + browser,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in pkg/workflow/playwright_cli.go: browsers install into ${RUNNER_TEMP}/gh-aw/playwright-browsers, a runner-temp path mounted into AWF, and the same path is exported to the agent execution environment.

Comment thread pkg/workflow/playwright_cli_test.go Outdated
Comment on lines +32 to +33
assert.Contains(t, browserStep, "playwright-cli install-browser "+browser)
assert.Contains(t, browserStep, "timeout-minutes: 10")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added compiler coverage that verifies all three browser provisioning steps use the shared mounted cache, and synchronized every generated lock file. This catches host-cache versus sandbox-cache mismatches before runtime.

Comment thread docs/src/content/docs/reference/playwright.md Outdated
Copilot AI and others added 2 commits September 1, 2026 17:42
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@lpcox

lpcox commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@pelikhan

pelikhan commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

@copilot playwright cli is the only mode so isPlaywrightCLIMode should always be true. Apply the env var to all agentic engines.

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed in commits 98b0b59 and 2aa8255: Playwright browsers now install into the runner-temp cache mounted into AWF, the cache path is exported during agent execution, affected lock files are synchronized, and the docs lifecycle starts with open. Focused Playwright tests and the full local test suite pass. The active CI run is still in progress and needs maintainer re-trigger/verification after this agent push.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

pelikhan commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

@copilot the user should specify the list of browser engines it wants as a child field of "playwright":

tools.playwright.browsers: [chrome, Firefox]

otherwise, by default Chrome is downloaded.

Create a bash script actions/setup/sh that takes a list of browser engines and downloads them. Use retries to make it more resilient.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot playwright cli is the only mode so isPlaywrightCLIMode should always be true. Apply the env var to all agentic engines.

Implemented in 057f3b2: built-in Playwright is treated as CLI-only regardless of the mode field, and PLAYWRIGHT_BROWSERS_PATH is applied across all agentic engine environment paths.

Copilot AI and others added 2 commits September 1, 2026 18:42
Copilot AI and others added 2 commits September 1, 2026 18:49
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the user should specify the list of browser engines it wants as a child field of "playwright":

tools.playwright.browsers: [chrome, Firefox]

...

Implemented in commit d2cc1b7: tools.playwright.browsers accepts chrome/chromium, firefox, and webkit, defaults to Chromium, validates entries, and provisions selected browsers through actions/setup/sh/install_playwright_browsers.sh with retries into the sandbox-mounted cache.

@pelikhan
pelikhan merged commit 723bde8 into main Sep 1, 2026
34 checks passed
@pelikhan
pelikhan deleted the copilot/improve-playwright-workflow-guidance branch September 1, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Playwright workflow guidance and reconcile CLI examples

5 participants