Skip to content

Browser: Playwright API metrics#316473

Merged
jruales merged 18 commits into
mainfrom
jruales/2026.05-playwright-code-logs
Jun 2, 2026
Merged

Browser: Playwright API metrics#316473
jruales merged 18 commits into
mainfrom
jruales/2026.05-playwright-code-logs

Conversation

@jruales
Copy link
Copy Markdown
Contributor

@jruales jruales commented May 14, 2026

Playwright API metrics for Integrated Browser

Copilot AI review requested due to automatic review settings May 14, 2026 18:41
@jruales jruales changed the title Playwright API metrics Browser: Playwright API metrics May 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds telemetry for the Integrated Browser run_playwright_code tool to capture Playwright page API usage, success, deferral, duration, and code-size metrics.

Changes:

  • Injects telemetry into RunPlaywrightCodeTool and logs completed/failed invocations.
  • Adds pageMethodsCalled to Playwright invocation results.
  • Wraps Playwright page with a proxy to count method calls and adds a telemetry event helper.
Show a summary per file
File Description
src/vs/workbench/contrib/browserView/electron-browser/tools/runPlaywrightCodeTool.ts Logs telemetry for Playwright code tool invocations.
src/vs/platform/browserView/node/playwrightService.ts Tracks Playwright page API calls via proxy and includes counts in invocation results.
src/vs/platform/browserView/common/playwrightService.ts Extends invoke result shape with page method call counts.
src/vs/platform/browserView/common/browserViewTelemetry.ts Defines and emits the new Playwright code telemetry event.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/platform/browserView/node/playwrightService.ts:722

  • Recursively creating a fresh proxy on every object-property read changes Playwright object identity semantics (for example, page.keyboard === page.keyboard becomes false). Code that caches, compares, or uses nested API objects as map keys can behave differently under this proxy; cache proxies per target/prefix so repeated property reads return the same wrapper.
			if (value !== null && typeof value === 'object') {
				return createPageApiProxy(value as object, methodCalls, `${prefix}${prop}.`, depth + 1);
  • Files reviewed: 4/4 changed files
  • Comments generated: 4

Comment thread src/vs/platform/browserView/node/playwrightService.ts
Comment thread src/vs/platform/browserView/node/playwrightService.ts
Comment thread src/vs/platform/browserView/node/playwrightService.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment thread src/vs/platform/browserView/node/playwrightService.ts
jruales added 5 commits June 2, 2026 13:06
Move completion telemetry out of the renderer chat tool and into PlaywrightSession in the shared process, so deferred executions are logged exactly once when the underlying page work settles - even if the agent never resumes the deferred result.
…before settling

Make _logExecution idempotent and emit the definitive outcome synchronously for executions that complete or fail within the timeout. Previously a failure thrown before settleWith ran (e.g. the page could not be resolved) left deferred.p pending, so the settlement-promise logger never fired and the execution went unlogged.
…right-code-logs

# Conflicts:
#	src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts
@jruales jruales marked this pull request as ready for review June 2, 2026 22:58
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering Bot commented Jun 2, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@deepak1556

Matched files:

  • src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts

@jruales jruales enabled auto-merge (squash) June 2, 2026 23:20
@jruales jruales merged commit 8390664 into main Jun 2, 2026
39 of 40 checks passed
@jruales jruales deleted the jruales/2026.05-playwright-code-logs branch June 2, 2026 23:59
@vs-code-engineering vs-code-engineering Bot added this to the 1.124.0 milestone Jun 3, 2026
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.

4 participants