Skip to content

Allow page-free Playwright execution to skip active-tab resolution - #352

Closed
ehfeng wants to merge 1 commit into
hypeship/fix-cross-context-pagefrom
codex/cus-580-skip-page-resolution
Closed

Allow page-free Playwright execution to skip active-tab resolution#352
ehfeng wants to merge 1 commit into
hypeship/fix-cross-context-pagefrom
codex/cus-580-skip-page-resolution

Conversation

@ehfeng

@ehfeng ehfeng commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a resolve_active_page request option that defaults to true
  • forward the option through the API daemon protocol
  • skip foreground-tab CDP resolution when page-free callers opt out
  • cover a browser-only page listing request in the Playwright e2e flow

Stack

This PR is based on #347 and contains only the page-free execution optimization. The strengthened cross-context regression assertion was committed directly to #347.

Higher-level callers such as browser-runtime.listPages must send resolve_active_page: false to use this path.

Validation

  • TypeScript strict type-check
  • esbuild daemon bundle
  • go vet ./...
  • go test ./cmd/api/api -count=1
  • go test ./e2e -run ^$ -count=1

The Docker-backed e2e was not run locally because Docker is unavailable.


Note

Medium Risk
Changes how injected page/context are chosen when callers opt out of active-tab resolution; default behavior stays the same, but wrong use of false could run code against an unintended tab.

Overview
Adds an optional resolve_active_page flag on Execute Playwright Code (defaults to true when omitted). The API forwards it through the Unix-socket daemon protocol so callers can skip Chrome foreground-tab CDP resolution when their script only uses browser (e.g. listing pages across contexts).

When resolve_active_page is false, the daemon no longer calls resolveActivePage before execution; it still injects page and context via the existing newest-open-page fallback. OpenAPI and generated oapi types document the field.

E2E coverage asserts that a browser-only request with resolve_active_page: false returns the expected page count without breaking the subsequent active-tab resolution test.

Reviewed by Cursor Bugbot for commit 6a4703a. Bugbot is set up for automated code reviews on this repo. Configure here.

@ehfeng
ehfeng requested review from masnwilliams and rgarcia August 24, 2026 21:48
@ehfeng
ehfeng force-pushed the codex/cus-580-skip-page-resolution branch 3 times, most recently from 2bb3e64 to 568088b Compare August 24, 2026 22:03
@ehfeng
ehfeng force-pushed the codex/cus-580-skip-page-resolution branch from 568088b to 6a4703a Compare August 24, 2026 22:05
@rgarcia

rgarcia commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

closing this: we decided against adding resolve_active_page to the execute API. skipping active-tab resolution for page-free scripts is a niche optimization that doesn't justify a permanent public schema field on this endpoint — the fallback path in #347 already keeps page-free scripts working. #355 has been rebased directly onto #347.

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