Skip to content

Add named Playwright executor support to browsers playwright commands - #281

Open
rgarcia wants to merge 1 commit into
mainfrom
hypeship/playwright-executors
Open

rgarcia wants to merge 1 commit into
mainfrom
hypeship/playwright-executors

Conversation

@rgarcia

@rgarcia rgarcia commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds named Playwright executor support to kernel browsers playwright.

  • kernel browsers playwright execute --executor <name>: runs the call in a named executor (sent only when set). Help text explains concurrency across executors, serialization within one, the always-present default executor bound to the active tab, named executors owning a background tab that page is bound to, and the limit of 8 named executors.
  • The execute result now shows the tab the call was bound to (Tab Target ID, Tab Created) in the table output; JSON output passes it through from the API response.
  • A 409 from execute (executor limit reached) is rendered as the API message followed by the current executors (name, busy marker, tab URL) and the delete command to run, instead of the generic error formatting.
  • New kernel browsers playwright executors list <id-or-name>: table of name, busy, created at, last used at, target ID, URL (default first); supports -o json.
  • New kernel browsers playwright executors delete <id-or-name> <executor> [--close-tab]: --close-tab defaults to true and is only sent when set explicitly. Deleting default reports a restart rather than a deletion, matching API semantics.
  • The playwright command group is now built by newBrowsersPlaywrightCommand() so it can be exercised in tests the same way the webmcp group is.
  • README command reference and examples updated.

Tests

cmd/browsers_playwright_executors_test.go covers command wiring and flag defaults, the executor request param (absent vs set), tab rendering in table and JSON output, the 409 limit error, list table/JSON rendering, delete path and close_tab query handling, API error cleanup, and argument validation, using an httptest server like the webmcp tests.

go build ./..., go vet ./..., go test ./..., and golangci-lint run all pass locally.

⚠️ Dependency note: do not merge yet

This PR depends on kernel/kernel PR https://github.com/kernel/kernel/pull/4614 (named Playwright executors API), which is not merged yet.

It uses a preview SDK build via a go.mod replace:

replace github.com/kernel/kernel-go-sdk => github.com/kernel/kernel-go-sdk-staging v0.86.1-0.20261005185731-8af651f4046b

Before merge, the replace directive must be removed and github.com/kernel/kernel-go-sdk bumped to the released version that includes the executors surface (BrowserPlaywrightExecuteParams.Executor, Tab on the execute response, BrowserPlaywrightExecutorService.List/Delete, Executor, ExecutorList).

CI test and build jobs fail on this branch for that reason only: kernel/kernel-go-sdk-staging is a private module and the workflows have no credentials for it, so go mod download cannot fetch the replace target. They pass locally with access to the module and will pass in CI once the replace is dropped for the released SDK.

@kernel-internal

Copy link
Copy Markdown
Contributor

🔧 CI Fix Available

I've pushed a fix for the CI failure.

What failed: make test never got past go vet — the replace directive in go.mod points kernel-go-sdk at github.com/kernel/kernel-go-sdk-staging, which is a private module that CI's GITHUB_TOKEN cannot read, so every package that imports the SDK failed to resolve.

What the fix does: the executor API isn't in any released SDK version yet (checked through the latest, v0.119.0), so it can't simply be re-pinned the way the two earlier staging-replace removals were. Instead the fix drops the replace directive and keeps the feature by defining the executor types in the CLI:

  • executors list and executors delete call the endpoints through the SDK's generic client, with close_tab sent via option.WithQuery
  • execute passes executor using params.SetExtraFields, and reads tab out of the raw response, since the released response type omits it

make test passes locally and all 316 lines of the new tests pass unmodified — they assert at the HTTP level, so they verify the requests stay wire-identical to the staging-SDK version.

This is a stopgap: once the executor API ships in a released SDK, the local types should be replaced with the generated kernel.Executor/kernel.ExecutorList and the typed Executors service.

👉 Click here to create a PR with the fix

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.

1 participant