Skip to content

fix(vscode): restore Playwright MCP browser tools - #14049

Merged
marius-kilocode merged 12 commits into
mainfrom
investigate-browser-automation-tool-exposure
Sep 16, 2026
Merged

marius-kilocode merged 12 commits into
mainfrom
investigate-browser-automation-tool-exposure

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Ordinary Code sessions lost the built-in kilo-playwright_* browser tools. The reported v7.5.16 session could use Web Search but could not open a browser or take a screenshot through the configured browser tools.

Why This Change Was Made

PR #13501 (commit 9231c255480) introduced the experimental Agent Manager browser and removed BrowserAutomationService, its MCP registration, and the Playwright enable/headless controls. This PR restores that service, originally added in a6c399fad1b, while retaining the separate experimental browser.

The two features have separate enablement and Chrome preferences. Playwright controls are under Web Tools; Agent Manager browser controls are under Experimental. No automatic preference migration is added.

Artifact history: commit 29afc26e39e proposed a temp output directory and repository ignore rules for #10149, but that branch did not land on main. This PR borrows its temp --output-dir approach; it does not restore previously shipped ignore rules. Explicit screenshot paths can bypass the default output directory, so artifact exclusion is not guaranteed. Adding repository-wide ignore rules or npx -y is outside this restoration because neither existed in the pre-removal implementation.

The review follow-up corrects the Agent Manager launch-error guidance after the setting move and reconciles folder additions/removals introduced by the restored multi-root tracking. Retained-folder MCP registrations are not restarted by folder changes. Existing backend-reconnect and shutdown behavior is left unchanged.

User Impact

Enable Playwright under Settings -> Web Tools -> Browser Automation to restore browser tools in normal Code sessions. The experimental Agent Manager browser remains separate, with its Browser icon controlled by its feature flag.

Evidence

  • Full extension unit suite: 5534 pass, 2 skip, 0 fail.
  • Full bun run typecheck, bun run compile, lint, knip, formatting, and the kilocode_change guard pass.
  • New lifecycle tests exercise real service code with VS Code and SDK boundary fakes: backend re-registration, queued disable during registration, disconnect/reconnect tracking, and workspace-folder reconciliation. Broker tests cover both runtime choices and their corrected recovery guidance.
  • Initial isolated VS Code test with a scripted model and real Playwright MCP: the agent received 24 Playwright tools, navigated to a local fixture, and captured a real screenshot. This was not a MiniMax model test.
  • Initial independence check: enabling Agent Manager left Playwright connected; disabling Playwright left the broker enabled; re-enabling Playwright reconnected it.
  • Current review-fix build, isolated VS Code: adding gamma started a new Playwright MCP process; removing beta stopped its process; retained alpha and gamma kept their process IDs. The instance and its MCP processes were cleaned up afterward. No cloud model was used for this scoped lifecycle check.
  • Agent Manager icon gating was verified on the subsequent build: the Browser icon appeared with the flag enabled and disappeared when disabled.

The Agent Manager preview flow itself was not exercised end to end. The earlier typecheck limitation was resolved after installing the worktree dependencies; full checks now pass.

PR #13501 removed the built-in Playwright MCP browser server while adding the Agent Manager browser, so ordinary Code sessions lost the kilo-playwright_* tools. Restore BrowserAutomationService and its Web Tools settings, and give the experimental Agent Manager browser its own Chrome preference so the two features stay independent.

Re-apply the temp output directory from #10149 so screenshots and traces stay outside the workspace.

Refs #13501, #10149.
Comment thread packages/kilo-vscode/src/extension.ts Resolved
@kilo-code-bot

kilo-code-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review of b9a81abf2b (previous review at 7a7bc0332b). The previous SUGGESTION on packages/kilo-vscode/src/services/browser-automation/chrome-setting.ts is resolved: migrateIntegratedBrowserUseSystemChrome() now reads only ...inspect?.<boolean>("useSystemChrome")?.globalValue, so a legacy Chrome preference set only at workspace scope is no longer promoted into the user's application-scoped setting, and the added test covers that case.

Files Reviewed (2 files)
  • packages/kilo-vscode/src/services/browser-automation/chrome-setting.ts
  • packages/kilo-vscode/tests/unit/browser-automation-chrome-setting.test.ts
Previous Review Summaries (9 snapshots, latest commit 7a7bc03)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 7a7bc03)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of 7a7bc0332b (previous review at 647d679bb3). The previous SUGGESTION on packages/kilo-vscode/src/services/browser-automation/chrome-setting.ts is resolved: integratedBrowserUseSystemChrome() no longer aliases the live Playwright setting, and the new migrateIntegratedBrowserUseSystemChrome() copies the legacy value once during activation, with the explicit-value guard, copy, and no-legacy-value cases covered by tests. One new suggestion was found on the changed code. Earlier findings on unchanged files remain active as inline comments and are not re-listed here.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/src/services/browser-automation/chrome-setting.ts 28 A legacy Chrome preference set only at workspace scope is promoted to the user's global settings.
Files Reviewed (3 files)
  • packages/kilo-vscode/src/services/browser-automation/chrome-setting.ts - 1 issue
  • packages/kilo-vscode/src/extension.ts - no new issues
  • packages/kilo-vscode/tests/unit/browser-automation-chrome-setting.test.ts - no new issues

Fix these issues in Kilo Cloud

Previous review (commit 647d679)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of 647d679bb3 (previous review at 23d8118233). The previous WARNING on packages/kilo-vscode/src/extension.ts (the Chrome-preference fallback disagreeing with the settings payload) is resolved: both the broker and the settings payload now call the shared integratedBrowserUseSystemChrome() helper, and the new unit test covers the explicit, fallback, and default cases. One new suggestion was found on the changed code. Earlier findings on unchanged files remain active as inline comments and are not re-listed here.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/src/services/browser-automation/chrome-setting.ts 19 The migration fallback reads browserAutomation.useSystemChrome, which is now a live Web Tools setting, so the Integrated Browser mirrors the Playwright Chrome toggle for every user.
Files Reviewed (5 files)
  • packages/kilo-vscode/src/services/browser-automation/chrome-setting.ts - 1 issue
  • packages/kilo-vscode/src/extension.ts - no new issues (previous warning resolved)
  • packages/kilo-vscode/src/KiloProvider.ts - no new issues
  • packages/kilo-vscode/tests/setup/vscode-mock.ts - no new issues
  • packages/kilo-vscode/tests/unit/browser-automation-chrome-setting.test.ts - no new issues

Fix these issues in Kilo Cloud

Previous review (commit 23d8118)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of 23d8118233 (previous review at 3a1380c1e6). The delta is 11 files / 85 lines: the bounded Playwright readiness timeout plus the wait constructor option, the legacy useSystemChrome fallback, dropping the unused outputDir option from playwrightCommand, a new lifecycle test, and systemChrome.title alignment in 7 locales. One new issue was found in the changed code.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/extension.ts 74 The legacy useSystemChrome fallback diverges from the value configSettings() reports, so Settings → Experimental can show the Integrated Browser toggle as ON while the broker resolves false and launches bundled Chromium.

Verification notes on the changed lines: BrowserAutomationService.bounded() handles both task outcomes, clears its timer on every meaningful path, and cannot produce an unhandled rejection, so no leak or race was found; the ready() timeout resolves by design and no caller depended on a rejection there. playwrightCommand has no caller passing outputDir, so removing the option is safe. The new timeout test is deterministic and does exercise the timeout branch. The 7 locale edits now match their settings.browser.systemChrome.title sibling, so the alignment goal holds. Earlier findings on unchanged files (settings.ts, browser-automation-service.ts, and the test/i18n suggestions) remain active as inline comments and are not re-listed here.

Files Reviewed (11 files)
  • packages/kilo-vscode/src/extension.ts - 1 issue
  • packages/kilo-vscode/src/services/browser-automation/browser-automation-service.ts - no new issues
  • packages/kilo-vscode/src/services/browser-automation/settings.ts - no new issues
  • packages/kilo-vscode/tests/unit/browser-automation-lifecycle.test.ts - no new issues
  • packages/kilo-vscode/webview-ui/src/i18n/{br,da,fr,ja,nl,no,tr}.ts - label alignment only

Fix these issues in Kilo Cloud

Previous review (commit 3a1380c)

Status: No Issues Found | Recommendation: Merge

Incremental review of 3a1380c1e6 (previous review at d06e27636a). The only commit with reviewable changes since the previous review is 3a1380c1e6 fix(vscode): translate browser automation settings into all locales; the other new commit is a merge of main, whose upstream changes are not part of this PR. The delta is 20 non-English locale dictionaries (100 changed lines) adding translated settings.experimental.browserAutomation.* strings and updating settings.browser.description to describe Playwright browser automation. These are dictionary values validated as Partial<Record<Keys, string>>; no runtime logic changed, so there is nothing new to flag.

The two warnings from the previous round are resolved on their changed lines: the Playwright readiness await in packages/kilo-vscode/src/KiloProvider.ts now sits before withRetry (retryable prompt errors keep their backoff), and closing a draft Browser panel in side-panel-state.ts clears the synthetic override (session() ? null : undefined) instead of storing an authoritative null that masked worktree-owned panels.

Earlier findings on files outside this increment (settings.ts, extension.ts, browser-automation-service.ts, and the test-quality/i18n suggestions) are unchanged, remain active as inline comments, and are not re-reported here.

Files Reviewed (20 files)
  • packages/kilo-vscode/webview-ui/src/i18n/*.ts (20 non-English locales) - translation dictionary updates; no issues

Previous review (commit d06e276)

Status: No Issues Found | Recommendation: Merge

Incremental review of d06e27636a (follow-up to ed92a23168). This commit resolves the two warnings from the previous round on their changed lines: the Playwright readiness await for prompts and commands now runs before withRetry (so retryable prompt errors keep their backoff and readiness is not retried mid-sequence), and a closed draft browser now clears its synthetic no-session override instead of storing an authoritative null. The test-quality and i18n suggestions are also addressed: the Agent Manager readiness test routes through the worktree directory and asserts readiness-before-prompt ordering, the disposal tests now assert listener registration so they fail if the server.instance.disposed listener is removed, and the Integrated Browser rename plus noSession copy were propagated to all 20 non-English agent-manager locales. Previously reported findings on files outside this increment (for example settings.ts and browser-automation-service.ts) are unchanged here, remain as existing inline comments, and are not carried forward into this summary.

Files Reviewed (25 files)
  • packages/kilo-vscode/src/KiloProvider.ts - readiness moved outside withRetry for prompt and command paths; no issues
  • packages/kilo-vscode/webview-ui/agent-manager/side-panel-state.ts - draft close clears the synthetic override; no issues
  • packages/kilo-vscode/tests/unit/browser-automation-lifecycle.test.ts - listener-registration assertions added; no issues
  • packages/kilo-vscode/tests/unit/kilo-provider-load-messages.test.ts - worktree readiness ordering test added; no issues
  • packages/kilo-vscode/tests/unit/side-panel-state.test.ts - draft/worktree masking test added; no issues
  • packages/kilo-vscode/webview-ui/agent-manager/i18n/*.ts (20 locales) - title rename and noSession copy; no issues

Previous review (commit ed92a23)

Status: 6 Issues Found | Recommendation: Address before merge

Incremental review of ed92a231 (follow-up to a564d582). Scope was the single commit since the previous review: the Playwright readiness gate for prompts, the Agent Manager Browser to Integrated Browser rename, and the new tests. Two previously reported findings are resolved on changed code: the recovery guidance in browser-broker.ts now points at Settings > Experimental for the Integrated Browser, and the workspace-folder listener it asked for is present. The settings.ts findings from the previous summary are unchanged code in this increment, so they are not carried forward. The two warnings below concern state masking and retry behavior; the rest are test-quality and i18n suggestions.

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 4
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/side-panel-state.ts 53 A sticky synthetic no-session null can hide a worktree-owned panel once the session ends.
packages/kilo-vscode/src/KiloProvider.ts 4263 The readiness await inside withRetry bypasses retry and can abort an in-flight retry sequence.

SUGGESTION

File Line Issue
packages/kilo-vscode/src/services/browser-automation/browser-automation-service.ts 69 Readiness is a no-op for Agent Manager worktree prompts because worktree dirs are not workspace folders.
packages/kilo-vscode/tests/unit/browser-automation-lifecycle.test.ts 188 Negative disposal tests still pass if the server.instance.disposed listener is removed.
packages/kilo-vscode/tests/unit/kilo-provider-load-messages.test.ts 1619 The Agent Manager readiness test passes a workspace session id, so it duplicates the preceding test.
packages/kilo-vscode/webview-ui/agent-manager/i18n/en.ts 401 The Integrated Browser rename was not propagated to the other 20 agent-manager locales.
Files Reviewed (39 files)
  • .changeset/restore-playwright-browser-tools.md, packages/kilo-docs/pages/automate/tools/index.md, packages/kilo-docs/pages/code-with-ai/features/browser-use.md - rename only; no images added, links intact
  • packages/kilo-vscode/package.json - setting descriptions renamed
  • packages/kilo-vscode/src/extension.ts, packages/kilo-vscode/src/KiloProvider.ts, packages/kilo-vscode/src/services/cli-backend/connection-service.ts - readiness wiring; 1 warning
  • packages/kilo-vscode/src/services/browser-automation/browser-automation-service.ts - ready() and disposal listener; 1 suggestion
  • packages/kilo-vscode/src/services/browser-automation/browser-broker.ts - recovery guidance now points at Experimental
  • packages/kilo-vscode/tests/unit/browser-automation-lifecycle.test.ts, browser-broker.test.ts, kilo-provider-load-messages.test.ts, kilo-provider-route-integration.test.ts, side-panel-state.test.ts - 2 suggestions
  • packages/kilo-vscode/webview-ui/agent-manager/side-panel-state.ts - 1 warning
  • packages/kilo-vscode/webview-ui/agent-manager/i18n/en.ts and packages/kilo-vscode/webview-ui/src/i18n/*.ts (21 files) - 1 suggestion
  • packages/opencode/src/kilocode/tool/browser-open.ts, packages/opencode/src/kilocode/tool/browser-open.txt - consistent rename

Fix these issues in Kilo Cloud

Previous review (commit a564d58)

Status: 2 Issues Found | Recommendation: Merge after confirming the deferred items

Incremental review of a564d582 (follow-up to 523f8f7). The incremental diff since the previous review contains no browser-automation code changes: it is a main-branch merge plus refreshed visual-regression baselines. The two findings below remain reproducible at HEAD and were explicitly deferred by the author, so they are carried forward rather than re-posted as duplicates.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/services/browser-automation/settings.ts 20 The restored --output-dir still ships without the #10149 .gitignore safety net, so explicitly-pathed artifacts can still be staged in git. The comment was softened to stop overclaiming, but the underlying gap remains (author deferred as pre-existing).

SUGGESTION

File Line Issue
packages/kilo-vscode/src/services/browser-automation/settings.ts 17 npx @playwright/mcp@latest is invoked without -y, so a first run can block on an install prompt under a non-interactive MCP launch; the docs added in this PR use npx -y (author deferred as pre-existing).
Files Reviewed (1 changed file)
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/full-screen-diff-with-changes-chromium-linux.png - refreshed baseline; no reviewable code. Browser-automation sources were re-verified as unchanged since 523f8f7.

Fix these issues in Kilo Cloud

Previous review (commit 523f8f7)

Status: 2 Issues Found | Recommendation: Merge after confirming the deferred items

Incremental review of 523f8f7 (follow-up to c6936a7). The follow-up commit introduces no new defects: workspace-folder reconciliation, Agent Manager recovery guidance, and reconnect/lifecycle test coverage are all addressed, and the --output-dir comment no longer overclaims. The two findings below are prior findings that are still reproducible at HEAD and were explicitly deferred by the author; they are carried forward rather than re-posted as duplicates.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/services/browser-automation/settings.ts 20 The restored --output-dir still ships without the #10149 .gitignore safety net, so explicitly-pathed artifacts can still be staged in git. The comment was softened to stop overclaiming, but the underlying gap remains (author deferred as pre-existing).

SUGGESTION

File Line Issue
packages/kilo-vscode/src/services/browser-automation/settings.ts 17 npx @playwright/mcp@latest is invoked without -y, so a first run can block on an install prompt under a non-interactive MCP launch; the docs added in this PR use npx -y (author deferred as pre-existing).
Files Reviewed (5 files)
  • packages/kilo-vscode/src/services/browser-automation/browser-automation-service.ts
  • packages/kilo-vscode/src/services/browser-automation/browser-broker.ts
  • packages/kilo-vscode/src/services/browser-automation/settings.ts
  • packages/kilo-vscode/tests/unit/browser-automation-lifecycle.test.ts
  • packages/kilo-vscode/tests/unit/browser-broker.test.ts

Fix these issues in Kilo Cloud

Previous review (commit c6936a7)

Status: 5 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 4
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/services/browser-automation/settings.ts 20 Restored --output-dir omits the .gitignore safety net from #10149, so custom-named artifacts can still be staged in git

SUGGESTION

File Line Issue
packages/kilo-vscode/src/services/browser-automation/settings.ts 17 npx without -y can prompt or hang on first run
packages/kilo-vscode/src/extension.ts 70 Agent Manager browser recovery message still points to Web Tools for Use System Chrome
packages/kilo-vscode/src/services/browser-automation/browser-automation-service.ts 26 No workspace-folder change reconciliation; per-folder registrations drift
packages/kilo-vscode/tests/unit/browser-automation-recovery.test.ts 4 Test named recovery does not cover reconnect re-registration
Files Reviewed (34 files)
  • .changeset/restore-playwright-browser-tools.md - clean
  • packages/kilo-docs/pages/automate/tools/index.md - clean
  • packages/kilo-docs/pages/code-with-ai/features/browser-use.md - clean
  • packages/kilo-vscode/package.json - clean
  • packages/kilo-vscode/src/KiloProvider.ts - clean
  • packages/kilo-vscode/src/extension.ts - 1 issue
  • packages/kilo-vscode/src/services/browser-automation/browser-automation-service.ts - 1 issue
  • packages/kilo-vscode/src/services/browser-automation/index.ts - clean
  • packages/kilo-vscode/src/services/browser-automation/settings.ts - 2 issues
  • packages/kilo-vscode/tests/unit/browser-automation-recovery.test.ts - 1 issue
  • packages/kilo-vscode/webview-ui/src/components/settings/BrowserTab.tsx - clean
  • packages/kilo-vscode/webview-ui/src/components/settings/ExperimentalTab.tsx - clean
  • packages/kilo-vscode/webview-ui/src/i18n/*.ts (21 locales) - clean
  • packages/kilo-vscode/webview-ui/src/types/messages/config.ts - clean

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

marius-kilocode and others added 4 commits September 11, 2026 11:28
Reconcile workspace folder changes in the restored Playwright service without restarting retained registrations. Point Agent Manager browser failures at its separate Experimental setting and add lifecycle regression coverage. Clarify the limits of the artifact output directory.
…rated Browser before a session

Wait for the Playwright MCP server before Agent Manager prompts as well as
sidebar prompts, and stop respawning a failed server on every prompt.
Let the Integrated Browser panel open on a fresh Local tab before a
session exists, and rename the Agent Manager browser to Integrated
Browser in settings, tool output, and docs.
Await Playwright readiness before withRetry so prompt errors keep their
backoff, drop the draft browser entry on close instead of storing an
authoritative null, translate the Integrated Browser panel strings in all
Agent Manager locales, and tighten the lifecycle and Agent Manager tests.
…utomation-tool-exposure

# Conflicts:
#	packages/kilo-docs/pages/automate/tools/index.md
Translate settings.browser.description for every non-English locale so it
describes Playwright browser automation instead of the previous Agent
Manager browser wording, and translate the Integrated Browser settings
strings in the experimental section.
Bound how long a prompt waits for Playwright MCP so a cold start cannot
stall the send path for the full MCP timeout, fall back to the previous
useSystemChrome key so existing Integrated Browser preferences keep
applying, drop an unused option from the Playwright command builder, and
align the duplicated Use System Chrome labels across locales.
Comment thread packages/kilo-vscode/src/extension.ts Resolved
Resolve the Integrated Browser Chrome preference through one shared helper
used by both the broker and the settings payload, so the value shown in
Settings matches the value the broker applies after the key move.
Copy a Chrome preference stored before the setting had its own key during
activation, and read only the Integrated Browser key afterwards, so the
Web Tools Playwright setting no longer aliases the Integrated Browser.
Leave a workspace-scoped legacy preference alone so opening a repository
that sets it does not elevate the value to the user's global settings.
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.

2 participants