fix: Pre-install Playwright browsers before AWF firewall starts#4872
Closed
Copilot wants to merge 3 commits into
Closed
fix: Pre-install Playwright browsers before AWF firewall starts#4872Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Added conditional Playwright browser pre-installation step that runs during the setup phase before the AWF firewall starts. This prevents timeout issues when Playwright MCP server tries to install browsers through the firewall. - Created HasPlaywrightMCPServer() to check if workflow uses Playwright - Created ShouldPreinstallPlaywrightBrowsers() to check if pre-install needed - Created GeneratePlaywrightBrowserInstallStep() for the installation step - Modified CopilotEngine.GetInstallationSteps() to add the step - Added comprehensive unit tests Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Playwright MCP server timeout in AWF firewall
fix: Pre-install Playwright browsers before AWF firewall starts
Nov 26, 2025
Collaborator
|
@copilot pre install should happen after runtime setup steps |
Contributor
|
✅ Agentic Changeset Generator completed successfully. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Playwright MCP server fails to start within the AWF firewall because browser installation requires apt access, which Squid proxy blocks. This wastes 2+ minutes (two 60-second timeouts) per workflow run.
Changes
New file:
pkg/workflow/playwright_browser_install.goHasPlaywrightMCPServer()- Checks if workflow uses PlaywrightShouldPreinstallPlaywrightBrowsers()- Returns true when Playwright configured AND firewall enabledGeneratePlaywrightBrowserInstallStep()- Creates thenpx playwright install --with-deps chromiumstepModified:
pkg/workflow/copilot_engine.goGetInstallationSteps()after Copilot CLI install, before firewall startsGenerated step
Impact
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/user/usr/bin/gh gh api user --jq .login(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
you are tasked to fix Playwright MCP Server Timeout in AWF Firewall
Problem Summary
The Playwright MCP server fails to start within the AWF firewall, causing 2 minutes of wasted time (two 60-second timeouts) before the agent can begin working.
Root cause: Playwright's browser installer tries to install system dependencies via
apt, which fails due to Squid proxy returning HTTP 400 errors for Ubuntu repository requests, despite domains being in the allowlist.Impact: 47% of execution time in smoke-copilot test is waiting for Playwright timeouts.
Recommended Solution: Pre-install Playwright Browsers
Install Playwright browsers during the setup phase (before firewall starts) where we have full network access.
Strategy: Add a conditional setup step that runs
npx playwright install --with-deps chromiumafter installing Copilot CLI but before starting the firewall.Net impact: Adds ~40-80 seconds to setup, but saves 2+ minutes in execution (net savings of 1-1.5 minutes per workflow run).
Implementation Plan
1. Create New File:
pkg/workflow/playwright_browser_install.goPurpose: Core browser pre-installation logic with proper error handling and logging.
Key functions:
ShouldPreinstallPlaywrightBrowsers(config *WorkflowConfig) bool- Checks if Playwright is configuredPreinstallPlaywrightBrowsers(ctx context.Context, logger *Logger) error- Runs installationgetPlaywrightMCPVersion() string- Returns version from constants for compatibilityImplementation details:
2. Modify:
pkg/workflow/copilot_engine.goLocation: In
GetInstallationSteps()function around line 790-800Changes:
3. Modify:
pkg/workflow/mcp_servers.goAdd helper function:
4. Add Integration Test:
pkg/cli/workflows/test-playwright-browser-preinstall.mdTest workflow:
Implementation Checklist
Phase 1: Core Implementation
pkg/workflow/playwright_browser_install.gowith installation logiccopilot_engine.gomcp_servers.goPhase 2: Integration & Testing
Phase 3: Documentation
Critical Files to Modify
pkg/workflow/playwright_browser_install.go (NEW, ~100 lines)
pkg/workflow/copilot_engine.go (MODIFY, +5-7 lines)
GetInstallationSteps()functionpkg/workflow/mcp_servers.go (MODIFY, +10 lines)
HasPlaywrightMCPServer()helper functionpkg/workflow/playwright_browser_install_test.go (NEW, ~50 lines)
pkg/cli/workflows/test-playwright-browser-preinstall.md (NEW)
Key Design Decisions
Version Compatibility:
@playwright/mcpversion for browser installationpkg/constants/constants.goBrowser Selection:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.