Skip to content

feat: wxt#151

Merged
ndthanhdev merged 11 commits into
mainfrom
wxt
Jul 5, 2026
Merged

feat: wxt#151
ndthanhdev merged 11 commits into
mainfrom
wxt

Conversation

@ndthanhdev

Copy link
Copy Markdown
Owner

No description provided.

ndthanhdev and others added 11 commits July 3, 2026 21:06
The custom browser-install script replaced `playwright install --with-deps`
but only downloaded and extracted the binaries, dropping the OS shared
libraries (libnss3, libgbm, libasound2, …) that chromium/firefox need to
launch. In CI every ext-e2e test failed with "browserType.launchPersistentContext:
Target page, context or browser has been closed".

Run `playwright install-deps <browsers>` after extraction — it apt-installs
the deps only (no browser download, so it stays clear of the btrfs extractor
deadlock). Gated on CI: the Dagger image is Debian/Ubuntu and runs as root,
while dev machines already have the libs and may not use apt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ServerDrivenTrpcChannelProvider.stop() resolved only when httpServer.close()
drained every connection, but it never force-closed keep-alive/active sockets.
With the m3 (MV3) extension still connected at teardown — service worker kept
warm by the content-script keepalive, auto-reconnecting and health-polling — the
sockets never drained, so stop() blocked until the ~30s WS keepalive reaped them.
That surfaced as a 30s Playwright teardown timeout on every m3 tool test
(mis-attributed to the adjacent client.close() line).

- stop(): call httpServer.closeAllConnections() (Node >=18.2) so close()
  completes promptly, and drop broadcastReconnectNotification() on shutdown so
  clients aren't told to re-dial sockets we're closing.
- McpClientPageObject.disconnect(): also call mcpServer.stop() to detach the
  BrowserResources onChange listener (stops the "sendResourceUpdated failed" log
  spam) and null the transports.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Zod v4 rejects `undefined` for required fields even when typed z.any().
Every void-returning extension tool call (clickOnElement, scrollPage,
fillTextToElement, hitEnterOnElement, closeTab, ...) resolves with
`result: undefined`, so relaying that back to the server via the
defer.resolve mutation failed input validation — the resolve message
never reached the server, leaving the original tool-call request pending
until the test's 30s timeout.

Root-caused via local e2e runs with content-script/service-worker console
capture: the extension performs the action and logs the resolve attempt,
but the mutation call itself throws a TRPCClientError
(invalid_type/expected: nonoptional) before reaching the server.

Fix: make `result` optional in the resolve input schema (and the
resolveDefer handler's opts type to match). Confirmed locally — full
ext-e2e suite went from 24 failed/44 passed (17.7m) to 68 passed/16
skipped (8.5m).

Also keep the disconnect() cleanup from the teardown-hang fix
(mcpServer.stop() to detach the BrowserResources listener before tearing
down the transport).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
browser-install.ts duplicated work-dirs.ts's root-path computation
(same import.meta.dirname math). Give work-dirs.ts the same
MOON_WORKSPACE_ROOT env-var override browser-install.ts already had —
a no-op under moon (moon sets that var to the same value the path math
produces) and a correctness improvement for standalone runs — then have
browser-install.ts consume workDirs.path instead of re-deriving root
itself.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Matches how every other work-dirs.ts consumer references it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
work-dirs.ts already pre-computes target/apps/etc paths; add the same
for tmp/browsers, tmp/pw-dl, tmp/pw-resolve so browser-install.ts (and
any future consumer) reads them instead of recomputing path.join calls
inline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ndthanhdev
ndthanhdev merged commit 830d95d into main Jul 5, 2026
5 of 10 checks passed
@ndthanhdev
ndthanhdev deleted the wxt branch July 5, 2026 20:26
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