Skip to content

All page-touching tools fail (~6.5s, 'Target page, context or browser has been closed') since 2026-07-16 — Cloudflare now hard-blocks the headless persistent phase #12

Description

@owenhuang1991

Since 2026-07-16 ~14:15 UTC, every page-touching tool call (perplexity_ask, perplexity_search, perplexity_research) fails after a constant ~6.5s with:

Error: page.evaluate: Target page, context or browser has been closed

The daemon then exits and the extension watchdog respawns it, so external MCP clients (Claude Code via start.mjs) also see MCP error -32000: Connection closed and lose their session.

Root cause (verified by isolated repro)

Perplexity's Cloudflare now appears to hard-block headless Chrome sessions — the Turnstile/managed challenge never clears headlessly, even reusing a profile that a headed session just cleared.

Repro with patchright (both 1.59.4 — the bundled version — and 1.61.1) + system Chrome 150.0.7871.124 on macOS (darwin arm64), fresh profile, https://www.perplexity.ai:

headless: title stays "Just a moment..." (localized "請稍候...") for 25s+, challenge never clears
headed:   challenge clears in ~5s, app fully reachable (search box present)

So the daemon's two-phase design (Phase 1 headed bootstrap solves CF → Phase 2 headless persistent context reuses cf_clearance from the shared profile) no longer works: the headless phase gets re-challenged, never passes, and the ~6.5s page watchdog tears the page down — which surfaces as the page.evaluate: Target page, context or browser has been closed error on every call.

Everything else was ruled out one by one on this machine before pinning it on CF:

  • single daemon, no lock contention (earlier daemon pile-up cleaned up separately)
  • fresh browser-data profile (rebuilt from vault cookies — vault unseal fine, Authenticated as user logged)
  • Chrome 150 + patchright basics verified fine standalone (headless page.evaluate works on other sites)
  • extension 0.8.54 / npm perplexity-user-mcp 0.8.53 are the latest available — no newer build to try

Workaround that restores service (tested locally)

In chunk-ZLKA2VC3.mjs (init()), launching the Phase 2 persistent context headed instead of headless fixes it — combined with the existing OFFSCREEN_POSITION_ARG (--window-position=-32000,-32000) the window stays invisible to the user, same as the headed bootstrap refresh path:

-      console.error("[perplexity-mcp] Launching headless persistent browser...");
-      const launchOpts = buildLaunchOptions(true);
+      console.error("[perplexity-mcp] Launching headed-offscreen persistent browser...");
+      const launchOpts = buildLaunchOptions(false);

buildLaunchOptions(false) already appends the off-screen positioning arg, so no other changes are needed. Suggest shipping this (or a config/env toggle, e.g. PERPLEXITY_PERSISTENT_HEADED=1) so users don't have to patch dist/.

Environment

  • Extension: nskha.perplexity-vscode 0.8.54 (daemon reports 0.8.53)
  • OS: macOS (darwin arm64, Darwin 25.5.0)
  • Chrome: 150.0.7871.124 (system), auto-updated 2026-07-15
  • Node: v24.17.0
  • patchright bundled: 1.59.4

Happy to provide daemon logs / audit.log excerpts if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions