Skip to content

Commit 37750b6

Browse files
Copilotpelikhangh-aw-bot
authored
Stop suggesting redundant Playwright CLI mode (#58041)
* Review Pi Playwright CLI guidance Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Stop suggesting redundant Playwright CLI mode Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Fix remaining Playwright CLI guidance and Pi regression coverage Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com> * Align Playwright compatibility guidance and trim scope Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com> * Fix fallback AW file list sync for compat docs Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
1 parent e96e161 commit 37750b6

9 files changed

Lines changed: 59 additions & 20 deletions

File tree

.changeset/patch-playwright-cli-only-guidance.md

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/aw/playwright.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ tools:
3030
version: "0.1.18"
3131
```
3232

33-
`mode: cli` is accepted but unnecessary. `mode: mcp` is not supported by the
34-
built-in tool. If MCP is required, configure and pin `@playwright/mcp` explicitly
35-
under `mcp-servers` and allow only the required tools.
33+
Omit `mode`; the built-in Playwright integration is CLI-only by default. The
34+
explicit `mode: cli` setting remains accepted for compatibility, but it is not
35+
needed and should be removed from workflows that still carry it. `mode: mcp` is
36+
not supported by the built-in tool. If MCP is required, configure and pin
37+
`@playwright/mcp` explicitly under `mcp-servers` and allow only the required
38+
tools.
3639

3740
## Configure network access
3841

.github/aw/syntax-tools-imports.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ The `tools:` field configures which tools the coding agent may use.
125125
```yaml
126126
tools:
127127
playwright:
128-
mode: cli # recommended: token-efficient CLI mode
129128
version: "0.1.11" # optional: @playwright/cli npm package version
130129
```
131130
- `timeout:` - Per-operation timeout in seconds for all tool and MCP calls (integer or expression, default: 60 s for all engines).

.github/workflows/shared/docs-server-lifecycle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This will:
7777

7878
## Playwright Browser Access
7979

80-
With **CLI mode** (`mode: cli`, recommended), `playwright-cli` runs directly on the runner — not in a Docker container. Use `localhost` directly to reach the dev server:
80+
With the built-in Playwright CLI integration, `playwright-cli` runs directly on the runner — not in a Docker container. Use `localhost` directly to reach the dev server:
8181

8282
```bash
8383
playwright-cli browser_navigate --url "http://localhost:4321/gh-aw/"
@@ -111,7 +111,7 @@ This will:
111111
## Usage Notes
112112

113113
- The server runs on `http://localhost:4321` and is accessible at `http://localhost:4321/gh-aw/` for curl/bash and playwright-cli
114-
- With CLI mode (`mode: cli`), use `localhost` directly for all playwright-cli commands — no bridge IP needed
114+
- With the built-in Playwright CLI integration, use `localhost` directly for all playwright-cli commands — no bridge IP needed
115115
- Always clean up the server when done to avoid orphan processes
116116
- If the server fails to start, check `/tmp/gh-aw/agent/preview.log` for errors
117117
- Node.js >= 22 is required; ensure `runtimes: node: version: "22"` is set in the workflow frontmatter

docs/src/content/docs/engines/pi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Analyze the repository and create a concise daily status report covering:
9090

9191
## Capabilities and limitations
9292

93-
Pi supports top-level `max-turns`, provider-prefixed models, and `engine.extensions`. Pi already runs in bare mode, so `engine.bare: true` is accepted but has no effect. Pi does not provide native MCP server integration, native `tools.web-search`, per-command bash allowlisting, `max-continuations`, native `engine.agent` selection, or custom `engine.harness` scripts. MCP-backed tools must be exposed through the required CLI proxy.
93+
Pi supports top-level `max-turns`, provider-prefixed models, and `engine.extensions`. Pi already runs in bare mode, so `engine.bare: true` is accepted but has no effect. The built-in `tools.playwright` integration works through `playwright-cli`; omit its `mode` field because CLI is the only built-in mode. Pi does not provide native MCP server integration, native `tools.web-search`, per-command bash allowlisting, `max-continuations`, native `engine.agent` selection, or custom `engine.harness` scripts. MCP-backed tools must be exposed through the required CLI proxy.
9494

9595
See the [AI engine feature comparison](/gh-aw/reference/engines/#engine-feature-comparison) and [Pi extensions reference](/gh-aw/reference/engines/#pi-extensions-extensions).
9696

docs/src/content/docs/reference/playwright.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ Playwright enables headless browser control for accessibility testing, visual re
99

1010
## Configuration
1111

12-
The built-in Playwright tool uses CLI mode. It is token-efficient because it does not load MCP tool schemas into the agent context, avoids Docker overhead, and reaches local development servers through `localhost`.
12+
The built-in Playwright tool is CLI-only by default. It is token-efficient because it does not load MCP tool schemas into the agent context, avoids Docker overhead, and reaches local development servers through `localhost`. If an older workflow still sets `mode: cli`, it continues to work for compatibility, but omitting `mode` is preferred.
1313

1414
```yaml wrap
1515
tools:
1616
playwright:
17-
mode: cli
1817
```
1918
2019
The compiler installs `@playwright/cli` as a global npm package, its skills, and
@@ -52,7 +51,6 @@ The `version` field pins the `@playwright/cli` npm package. Omit it to use the c
5251
```yaml wrap
5352
tools:
5453
playwright:
55-
mode: cli
5654
version: "0.1.18"
5755
```
5856

@@ -120,7 +118,8 @@ Capture `/tmp/home.png`, then call `upload_artifact` with
120118
121119
## Migrate from Playwright MCP
122120
123-
Remove `mode: mcp` or replace it with `mode: cli`. The compiler now reports `mode: mcp` as an error.
121+
Remove `mode: mcp`. The built-in integration is CLI-only, so no replacement
122+
`mode` field is needed. The compiler now reports `mode: mcp` as an error.
124123

125124
Replace MCP tool calls in prompts with equivalent `playwright-cli` commands run through bash:
126125

@@ -173,7 +172,6 @@ on:
173172
174173
tools:
175174
playwright:
176-
mode: cli
177175
178176
network:
179177
allowed:
@@ -238,7 +236,6 @@ steps:
238236
239237
tools:
240238
playwright:
241-
mode: cli
242239
version: "0.1.18" # pins `@playwright/cli` npm package; see Configuration > Version
243240
bash:
244241
- "npm *"
@@ -289,7 +286,6 @@ on:
289286
290287
tools:
291288
playwright:
292-
mode: cli
293289
bash: [":*"]
294290
295291
network:

pkg/workflow/playwright_cli.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ package workflow
2222
//
2323
// tools:
2424
// playwright:
25-
// mode: cli
2625

2726
import (
2827
"strings"

pkg/workflow/playwright_validation.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
//
88
// # Migration
99
//
10-
// To migrate from MCP mode to CLI mode:
10+
// To migrate from MCP mode to the built-in CLI integration:
1111
//
12-
// 1. Add `mode: cli` to your playwright tool configuration:
12+
// 1. Remove `mode: mcp` from your playwright tool configuration:
1313
//
1414
// tools:
1515
// playwright:
16-
// mode: cli
1716
//
1817
// 2. Update prompts to use `playwright-cli <command>` via bash instead of
1918
// MCP browser tool calls. For example:
@@ -60,15 +59,15 @@ func (c *Compiler) validatePlaywrightMode(workflowData *WorkflowData) error {
6059
"tools.playwright.mode",
6160
mode,
6261
"mode must be a literal value; expressions are not allowed",
63-
"Set mode to cli, or omit mode because CLI is the default",
62+
"Remove mode because the built-in Playwright integration is CLI-only",
6463
)
6564
}
6665
if mode, ok := config["mode"].(string); ok && strings.EqualFold(mode, "mcp") {
6766
return NewValidationError(
6867
"tools.playwright.mode",
6968
mode,
7069
"built-in Playwright MCP support has been removed",
71-
"Remove `mode: mcp` or change it to `mode: cli`, then update prompts to run `playwright-cli <command>` from bash. If MCP is still required, configure Playwright explicitly under `mcp-servers`. See https://github.com/github/gh-aw/blob/main/docs/src/content/docs/reference/playwright.md",
70+
"Remove `mode: mcp`, then update prompts to run `playwright-cli <command>` from bash. If MCP is still required, configure Playwright explicitly under `mcp-servers`. See https://github.com/github/gh-aw/blob/main/docs/src/content/docs/reference/playwright.md",
7271
)
7372
}
7473
if browsers, ok := config["browsers"].([]any); ok {

pkg/workflow/playwright_validation_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,48 @@ tools:
9797

9898
require.Error(t, err)
9999
assert.Contains(t, err.Error(), "built-in Playwright MCP support has been removed")
100+
assert.Contains(t, err.Error(), "Remove `mode: mcp`")
101+
assert.NotContains(t, err.Error(), "mode: cli")
100102
assert.Contains(t, err.Error(), "playwright-cli <command>")
101103
assert.Contains(t, err.Error(), "mcp-servers")
102104
}
103105

106+
func TestPiEngineAcceptsPlaywrightWithImplicitCLIMode(t *testing.T) {
107+
tmpDir := t.TempDir()
108+
mdPath := filepath.Join(tmpDir, "test-workflow.md")
109+
content := `---
110+
name: pi-playwright-cli
111+
on: push
112+
engine: pi
113+
permissions:
114+
contents: read
115+
issues: read
116+
117+
tools:
118+
github:
119+
mode: gh-proxy
120+
cli-proxy: true
121+
playwright:
122+
---
123+
124+
# Test Workflow
125+
`
126+
require.NoError(t, os.WriteFile(mdPath, []byte(content), 0o644))
127+
128+
compiler := NewCompiler()
129+
require.NoError(t, compiler.CompileWorkflow(mdPath))
130+
131+
lockPath := filepath.Join(tmpDir, "test-workflow.lock.yml")
132+
lockContent, err := os.ReadFile(lockPath)
133+
require.NoError(t, err)
134+
lockStr := string(lockContent)
135+
136+
assert.Contains(t, lockStr, "@playwright/cli")
137+
assert.Contains(t, lockStr, "playwright-cli install --skills")
138+
assert.NotContains(t, lockStr, "@playwright/mcp")
139+
assert.NotContains(t, lockStr, "mode: cli")
140+
}
141+
104142
// TestCompileWorkflowRejectsLegacyPlaywrightMCPModeWithArgs ensures that a legacy
105143
// configuration combining `mode: mcp` with the removed MCP-only `args` field still
106144
// surfaces the actionable migration error instead of a generic JSON schema

0 commit comments

Comments
 (0)