Skip to content

fix(browser): clean up failed guarded navigation routes - #113753

Merged
steipete merged 1 commit into
mainfrom
codex/fix-autoqa-browser-navigation-route-cleanup-1bfd
Jul 25, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-autoqa-browser-navigation-route-cleanup-1bfd

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where browser users could be left with a stale request-interception route after Playwright failed to set up guarded navigation. It also fixes successful navigations silently ignoring route-removal failures while the target page remains open, causing later browser requests on that tab to run with inconsistent interception state.

The issue is real for the pinned [email protected]: its Page.route registers the exact client-side handler before awaiting fallible browser interception setup.

Why This Change Was Made

Reuse the already existing removePageNavigationRequestGuard owner helper and the established sibling post-cleanup decision pattern. Roll back only the failed navigation’s exact route, preserve the original setup or navigation failure, report cleanup failures for live pages, ignore expected cleanup failures after a page closes, and maintain blocked-navigation quarantine and policy precedence.

All result decisions occur after cleanup; no value is returned and no error is thrown from a finally block. There are no changes to browser security policy, Chrome or IME code, config, consent, dependencies, persistence, or protocols.

User Impact

A failed browser navigation no longer leaves behind a hidden interception handler affecting subsequent requests on the same tab. Open-page interception cleanup failures are accurately returned; closed-tab cleanup remains harmless; and blocked targets are still quarantined and closed.

Evidence

  • Base: exact current main 1bfd207a5405c38d04b052c8eb7291cadabce99e; only the canonical browser-navigation owner and its existing owner test are changed.
  • Independently verified the pinned Playwright 1.61.1 upstream source at 39e3553a4f283a41134d75d7e404484bd9e6865a: Page.route registers its handler before the fallible interception-pattern update, and Page.unroute removes only the matching handler.
  • True isolated regression reproduction against unchanged main: the existing browser owner test suite reports 2 failed, 40 passed. The failures demonstrate the missing exact-handler rollback after route setup rejection and the swallowed open-page cleanup failure.
  • Five real owner regressions verify failed setup rollback, open-page cleanup errors, original navigation-error precedence, closed-page cleanup, and SSRF-blocked target quarantine.
  • Final isolated remote proof: 292/292 actual tests passed across 14 browser owner and sibling suites, including guarded navigation, snapshots, existing-session actions, CDP connections, tab creation, and remote-profile operations.
  • Complete exact-branch changed gate: node scripts/check-changed.mjs --base HEAD -- extensions/browser/src/browser/pw-session-navigation.ts extensions/browser/src/browser/pw-session.create-page.navigation-guard.test.ts; passed production/test typechecks, formatting, exact-owner lint, dependency/plugin boundaries, and all required guards. Authoritative remote timing: 278,833 ms; exit code 0.
  • Fresh independent final-code autoreview: 0 actionable findings; confidence 0.98.
pnpm test \
  extensions/browser/src/browser/pw-session.create-page.navigation-guard.test.ts \
  extensions/browser/src/browser/navigation-guard.test.ts \
  extensions/browser/src/browser/pw-session.assert-navigation-safety.test.ts \
  extensions/browser/src/browser/pw-tools-core.interactions.navigation-guard.test.ts \
  extensions/browser/src/browser/pw-tools-core.snapshot.navigate-guard.test.ts \
  extensions/browser/src/browser/routes/agent.act.existing-session-navigation-guard.test.ts \
  extensions/browser/src/browser/pw-session.termination-cdp-ssrf.test.ts \
  extensions/browser/src/browser/server-context.remote-profile-tab-ops.playwright.test.ts \
  extensions/browser/src/browser/server-context.remote-profile-tab-ops.fallback.test.ts \
  extensions/browser/src/browser/pw-session.connections.test.ts \
  extensions/browser/src/browser/pw-session.test.ts \
  extensions/browser/src/browser/pw-session.page-cdp.test.ts \
  extensions/browser/src/browser/pw-tools-core.browser-ssrf-guard.test.ts \
  extensions/browser/src/browser/pw-tools-core.snapshot.test.ts

node scripts/check-changed.mjs --base HEAD -- \
  extensions/browser/src/browser/pw-session-navigation.ts \
  extensions/browser/src/browser/pw-session.create-page.navigation-guard.test.ts

AI-assisted; true-red reproduction, pinned upstream dependency contract, sibling owner semantics, and final cleanup/error precedence independently reviewed.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 25, 2026
@steipete
steipete merged commit dd60679 into main Jul 25, 2026
120 of 122 checks passed
@steipete
steipete deleted the codex/fix-autoqa-browser-navigation-route-cleanup-1bfd branch July 25, 2026 16:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant