Skip to content

fix(browser): report a crashed tab instead of a timeout - #195094

Open
mushuiyu886 wants to merge 15 commits into
openclaw:mainfrom
mushuiyu886:fix/browser-crashed-tab
Open

mushuiyu886 wants to merge 15 commits into
openclaw:mainfrom
mushuiyu886:fix/browser-crashed-tab

Conversation

@mushuiyu886

@mushuiyu886 mushuiyu886 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Related: #194667

What Problem This Solves

Fixes: a tab whose renderer process dies keeps being treated as a normal page, so snapshot waits for its full timeout and fails with a generic timeout plus the "browser is currently unavailable" retry hint, while screenshot/navigate surface raw Playwright text (page.screenshot: Target crashed). The agent is told the whole browser is unavailable even though only that tab is dead, and retries the dead target instead of opening a new tab.

User Impact

User impact: every action on a crashed tab now fails at once with tab crashed (renderer exited); open the URL in a new tab and retry (HTTP 409, no retry hint), and the dead tab can still be removed with browser close.

Why This Change Was Made

  • The per-page state records Playwright's crash event, and page resolution refuses a target whose renderer already died instead of letting the operation run against it.
  • Crash facts are also keyed by cdpUrl + targetId, so a replacement Page object for the same target remains refused after reconnect or re-enumeration.
  • Target identity is independent of document-scoped role refs, so main-frame navigation cannot erase a later crash report.
  • Batch resolution admits the target for per-child admission. Close-only batches retain the crash exemption needed for cleanup, while every non-close child still refuses the dead renderer with the typed conflict.
  • A crash raised during a batch child is rethrown through the existing route mapper instead of becoming a raw child-result string, and later children stop even with stopOnError=false.
  • Native text insertion preserves the crash classification before its sanitizing fallback; ordinary insertion failures still drop the original error and cannot expose pasted text through an error cause. The intentional suppression is recorded in the repository's explicit production-suppression allowlist.
  • Every close path skips the crash assertion because removing the dead tab is the recovery action recommended by the error.
  • Playwright's raw crash errors are normalized before matching: only Playwright's own framing maps, including page/locator and keyboard/mouse APIs, after comparing the first line with trailing whitespace and browser logs removed.

The follow-up regression uses the real getPageForTargetId and real closePageViaPlaywright, rather than copying crash admission into a mock resolver. Related is intentional: tab-list crash markers remain a separate follow-up.

Evidence

Real managed Chrome 138 profile, renderer killed with CDP Page.crash on http://127.0.0.1:18080/:

action before after
browser snapshot 17.0 s, page.ariaSnapshot: Target crashed 6.7 s total, explicit tab-recovery message
browser navigate raw Target crashed same explicit message
browser screenshot raw Target crashed same explicit message
browser close n/a {"ok": true}, tab removed
healthy-tab snapshot (control) 7.0 s 7.0 s

The after timings include ~6.5 s of CLI startup; the crashed-tab request itself returns as fast as a healthy one.

Regression coverage:

  • With the previous parent-only batch admission, the real-resolver close-only regression fails with BrowserTabCrashedError; the click regression records [false] instead of [true, undefined]. Production was restored after the red proof.
  • The close-only batch now crosses the real resolver and real close helper, closes the crashed page, and records [true, true]: the parent and close helper both retain the exemption.
  • The click batch rejects BrowserTabCrashedError without clicking and records [true, undefined], proving that the child performs its own refusal after the parent admits the batch.
  • The in-flight batch regression returned an unmapped child result before the fix; it now maps the propagated crash to HTTP 409 and proves a later hover is not called with stopOnError=false.
  • The native-insertion regression returned the sanitized ordinary paste failure before the fix; it now rejects BrowserTabCrashedError. The existing synthetic-password control still proves that ordinary Playwright insertion failures expose neither the text nor its original error cause.
  • Keyboard/mouse crash prefixes map to the same 409, while page-script errors containing Target crashed and ordinary target-close errors retain their existing classification.
  • pw-session-state.crash.test.ts also covers crash identity after navigation clears role refs and replacement Page objects for the same target.
  • Focused errors + batch suites after the final fixes: 26/26 tests passed, including 20/20 batch tests and the ordinary paste-sanitization control.
  • Final pnpm test:extension browser in the qualified Node 24 container with Docker init: 2994 passed, 116 skipped in the browser config and 158 passed in the database-workers config; exit 0.
  • oxfmt --check: clean. Focused production syntax lint and type-aware lint for the changed suppression inventory: 0 warnings/errors. Mock-export ratchet: 6359 grandfathered factories after exactly two retired entries were removed. Test-line ratchet: 6579642, ceiling 6579643, slack 1, with exact net regression allocation 276 and no shared-scalar increase.
  • Final autoreview (Claude engine), P0–P2, from merge-base 1cba5e993 through the working tree later committed as 77f79a52f0fe192cabd74323aac11da40ea2b0a4: one complete pass, machine status scoped-clean, with no accepted/actionable findings. The reviewer did not execute tests; the focused and full-lane results above are separate local proof.

Type validation: the repository's exact node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfo command passed in a node:24-bookworm container after the final edits. The host could not execute the pinned tsrs binary because its GLIBC is too old; the container supplied the required runtime without changing dependencies or bypassing the check. Direct tsc without built SDK declarations was not used as a substitute. No second managed Chrome run is claimed for the final targeted in-flight batch/insertText fixes; their added proof is through the production owners and existing route mapper.

Known boundaries

  • action=tabs still lists a crashed tab as a normal page; marking it is a follow-up that needs a target-scoped crash registry outside the live connection.
  • A crash that happens before this process registers the listener (fresh attach to an already-crashed external target) is not retro-detected.
  • Chrome MCP (existing-session) profiles never resolve a Playwright Page, so they get the message mapping only.

Real Behavior Proof (Batch & Native Insertion on Managed Chromium 156)

Executed against a real headless Chromium (Chrome/156.0.8078.73) over a local loopback CDP endpoint through shipped executeActViaPlaywright + toBrowserErrorResponse:

  1. Healthy tab control (batch with stopOnError: false containing click -> insertText("healthy-input") -> click): succeeded (results=[true,true,true], boxValue="healthy-input", clickCount=1).
  2. Permissive batch mid-run tab crash (batch with stopOnError: false, Page.crash triggered mid-step 1 before step 2 click #b2): stopped before step 2, threw page.waitForTimeout: Page crashed, classified by isBrowserTabCrashedError=true, mapped to HTTP 409 "tab crashed (renderer exited); open the URL in a new tab and retry".
  3. Native insertion (insertText) on crashed tab: threw BrowserTabCrashedError (instanceof=true), mapped to HTTP 409 "tab crashed (renderer exited); open the URL in a new tab and retry", with leaksText=false (inserted token not echoed in error message).
[repro] Chromium started: Chrome/156.0.8078.73
[1. healthy-control] results=[true,true,true] boxValue="healthy-input" clickCount=1
[2. permissive-batch-midrun-crash] isBrowserTabCrashedError=true status=409 body="tab crashed (renderer exited); open the URL in a new tab and retry" raw="page.waitForTimeout: Page crashed"
[3. native-insertion-crashed-tab] isBrowserTabCrashedError=false instanceof=true status=409 leaksText=false body="tab crashed (renderer exited); open the URL in a new tab and retry"

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Track crashed browser tabs and return tab-specific recovery guidance while allowing their closure.

Example: Chrome's renderer for target T crashes before a browser snapshot request.

  • Before: The snapshot waits for a timeout and suggests that the browser is unavailable.
  • After: The request returns HTTP 409 with instructions to open the URL in a new tab; closing T remains available.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, demonstrated crash recovery with the prior blocker repaired; overall tier is capped because this intentionally implements only part of the linked issue.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Supplied managed Chrome CLI evidence exercises snapshot, navigation, screenshot, closure, and a healthy control; real Chromium transport traces additionally exercise mid-batch crash propagation and native insertion through production owners and the error mapper.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: After one renderer crashes, the agent receives a timeout or raw Playwright failure and may report that the whole browser is unavailable.
Reason: Prompt tab-specific recovery has clear value for a reported production failure; Related correctly preserves the linked issue's remaining tab-list work.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR addresses a current browser defect and fixes the previous operator-input regression; no blocking code findings remain.

Reviewed head: cc9a98866808bdefdfd513e599d07e018f8d49bf

Before merge

  • Await maintainer action - A maintainer must authorize the action-required workflows for cc9a988 and let the required CI gate complete.

Findings

None.

Agent review details

How this fits together

Browser routes resolve Chrome targets through the Playwright session owner, execute page operations, and translate failures into responses consumed by the CLI and agent tools.

flowchart TD
  A[CLI or agent tool] --> B[Browser routes]
  B --> C[Playwright target resolution]
  D[Page crash event] --> E[Page and target crash state]
  E --> C
  C --> F[Page operation or close]
  F --> G[Browser error response]
Loading

Technical review

Best possible solution:

Land the focused crash-reporting repair once required CI passes, leaving tab-list markers to the broader tracked work.

Do we have a high-confidence way to reproduce the issue?

The affected-release report supplies a concrete Page.crash reproduction, and current main lacks the corresponding crash listener and refusal path; this review did not execute it.

Is this the best way to solve the issue?

The patch uses existing page-state, target-resolution, close, and error-mapping owners without introducing a competing execution path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8f8e2d5aadd8.

Provenance checked

  • Shared act and operator execution keeps the original intent (9ffa050: Share navigation, download, dialog, and quarantine handling across act calls and operator input bursts.)
  • Native paste error sanitization keeps the original intent (24a845b: Support native browser paste while preventing dependency errors from exposing inserted passwords.)
  • Page-state lifecycle ownership keeps the original intent (425df19: Simplify request and page-state ownership; the crash listener extends that existing lifecycle owner.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Daniel: Raw commit 9ffa050 adds extensions/browser/src/browser/pw-tools-core.interactions.execution.ts:185 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9ffa0502cc89; files: extensions/browser/src/browser/pw-tools-core.interactions.execution.ts)

PR surface

Source +107, Tests +299, Other +4. Total +410 across 17 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 114 7 +107
Tests 7 320 21 +299
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 6 2 +4
Total 17 440 30 +410

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (5 earlier review cycles)
  • reviewed 2026-11-08T07:39:00.506Z sha cf4dcf126ccbc0471ae8b97a7f21b582e06135ae :: needs changes before merge. :: [P2] Allow crashed-target cleanup inside batches | [P2] Preserve crash identity across role-ref invalidation | [P2] Account for justified regression-test growth
  • reviewed 2026-11-08T15:51:24.249Z sha 435a484 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-08T16:33:51.097Z sha 746ecee :: needs maintainer review before merge. :: none
  • reviewed 2026-11-10T05:59:31.227Z sha 77f79a5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-27T06:35:51.629Z sha 974e27e :: blocked before merge. :: [P1] [P1] Pass the crash exemption without requiring an act request

Reviewed November 27, 2026, 3:18 AM ET / 08:18 UTC (Revision 6).

@mushuiyu886
mushuiyu886 force-pushed the fix/browser-crashed-tab branch from cf4dcf1 to 4a569b8 Compare November 8, 2026 07:41
@mushuiyu886
mushuiyu886 force-pushed the fix/browser-crashed-tab branch from 643521f to 435a484 Compare November 8, 2026 15:22
@mushuiyu886

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 8, 2026
@mushuiyu886

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@mushuiyu886

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 27, 2026
@mushuiyu886

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@mushuiyu886

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 27, 2026

This branch has not been deployed

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

Labels

extensions: browser P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant