Skip to content

fix(browser): deep doctor hangs on stalled page snapshots - #119280

Closed
zhangguiping-xydt wants to merge 4 commits into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-116747
Closed

zhangguiping-xydt wants to merge 4 commits into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-116747

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Related: #116747

What Problem This Solves

Fixes an issue where users running openclaw browser --browser-profile chrome doctor --deep could wait beyond the diagnostic deadline when an extension-backed page accessibility command stalled, even though the relay remained connected and shared tabs were visible.

Why This Change Was Made

The canonical /doctor route owns one bounded live-snapshot request and carries its cancellation through tab selection, Playwright/CDP connection setup, and the auxiliary page session that owns the snapshot command. Cancellation retires only that auxiliary session and reports the affected tab and CDP method; it does not detach shared tabs or replace the active extension relay.

This update ports the repair onto current main so its candidate-hello validation and missed-pong retirement stay intact. The browser CLI now imports URL redaction from the narrow openclaw/plugin-sdk/browser-config subpath, with a cold-import regression check to prevent loading the CDP runtime graph for that helper.

User Impact

Deep browser doctor returns an actionable bounded failure for a stalled extension or direct-CDP snapshot. Normal browser actions, sibling tabs, and successor connections remain usable.

Evidence

The reporter path was exercised with a real development Gateway, real Headless Chrome 138, the unpacked production MV3 extension, and two shared tabs. A transparent relay proxy forwarded worker traffic unchanged except for withholding one real Accessibility.enable result after attach and tab enumeration succeeded.

$ openclaw browser --browser-profile chrome doctor --deep
TRIGGER real Chromium + Gateway + MV3 extension; two shared tabs
TRANSITION withheld one real Accessibility.enable result after successful attach
FAIL live-snapshot: Deep browser doctor live snapshot timed out after 10000ms
OUTCOME sharedTabs=2 sharedTabDetachCommands=0 siblingSnapshotExit=0

The direct-CDP owner was separately exercised against a real Chrome page WebSocket while one real accessibility-tree response was withheld: cancellation preserved the exact deadline reason, closed only the cancelled socket, and a successor connection completed successfully.

Current-main regression checks passed:

  • pnpm exec vitest run --config test/vitest/vitest.extension-browser.config.ts extensions/browser/src/cli/browser-cli.cold-imports.test.ts extensions/browser/src/browser/extension-relay/relay-bridge.test.ts — 28/28.
  • pnpm exec vitest run --config test/vitest/vitest.extension-browser.config.ts extensions/browser/src/browser/routes/basic.existing-session.test.ts — 24/24.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 11:58 PM ET / August 12, 2026, 03:58 UTC.

ClawSweeper review

What this changes

The PR adds a bounded deep browser-doctor snapshot across extension relay, Playwright, and direct CDP paths, while keeping browser CLI imports lightweight.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still lacks a bounded extension-relay live snapshot, while this PR repairs that path and resolves the prior relay-lifecycle findings; its current merge conflict must be reconciled before landing.

Priority: P2
Reviewed head: 1d40c2ee6cb2d46e54ca3d138ec1e40fc792fa38

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The real behavior proof and focused lifecycle coverage are strong; rebasing the currently conflicting branch is the remaining material confidence step.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body records after-fix real Gateway, Chromium, MV3 extension, and direct-CDP fault-injection runs with bounded failure and preserved sibling-session behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body records after-fix real Gateway, Chromium, MV3 extension, and direct-CDP fault-injection runs with bounded failure and preserved sibling-session behavior.
Evidence reviewed 6 items Current-main gap: Current main’s deep probe either warns when a tab has no per-tab WebSocket or snapshots without a route-owned deadline; it therefore cannot bound the extension-relay page-session path.
Repair owner boundary: The PR places the deadline in the canonical doctor route and carries its signal through tab selection, direct CDP, and capture-only Playwright probing.
Prior relay findings resolved: The PR keeps the active extension until a candidate supplies a valid hello, retains missed-pong retirement, and retires only the cancelled auxiliary page session.
Findings None None.
Security None None.

How this fits together

Browser doctor runs through the browser plugin’s Gateway route, selects a shared tab, and probes it through direct CDP or the extension relay’s Playwright connection. Its report tells an operator whether a tab can actually be inspected rather than merely whether the relay is connected.

flowchart LR
  CLI[Browser doctor CLI] --> Route[Gateway doctor route]
  Route --> Select[Select shared tab]
  Select --> Probe[Bounded live snapshot]
  Probe --> Direct[Direct CDP]
  Probe --> Relay[Extension relay and Playwright]
  Direct --> Report[Actionable doctor report]
  Relay --> Report
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as dirty against main; rebasing can alter the coupled relay, Playwright, and CLI-loader behavior, so exact-head validation is required afterward.
  • Resolve merge risk (P1) - Production code grows by 251 net lines across cancellation, session ownership, CLI loading, and migration guards; this is justified by the new bounded diagnostic path but deserves maintainer review as one coherent change.
Agent review details

Security

None.

PR surface

Source +351, Tests +1220, Generated 0. Total +1571 across 34 files.

View PR surface stats
Area Files Added Removed Net
Source 18 706 355 +351
Tests 15 1319 99 +1220
Docs 0 0 0 0
Config 0 0 0 0
Generated 1 2 2 0
Other 0 0 0 0
Total 34 2027 456 +1571

Review metrics

Metric Value Why it matters
Production versus test LOC production +585/-334 (net +251); tests and test support +1326/-106; generated docs +2/-2 The bug fix spans several runtime ownership layers, so its positive production growth merits review after conflict resolution.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/browser/src/browser/cdp.internal.test.ts, migration/backfill/repair: extensions/browser/src/browser/pw-session.page-cdp.test.ts, migration/backfill/repair: extensions/browser/src/browser/routes/basic.existing-session.test.ts, migration/backfill/repair: extensions/browser/src/browser/routes/basic.ts, migration/backfill/repair: extensions/browser/src/browser/server.agent-contract-core.test.ts, migration/backfill/repair: src/cli/program/config-guard.test.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #116747
Summary: This PR is a concrete candidate repair for the linked extension-relay page-command timeout report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Rebase and prove the exact head (recommended)
    Resolve the current conflict, retain the targeted relay lifecycle tests, and rerun the deep-doctor fault scenario plus focused browser tests on the resulting head.
  2. Pause if isolation cannot be preserved
    Do not merge if conflict resolution broadens cancellation beyond the diagnostic auxiliary page session or changes active relay replacement behavior.

Technical review

Best possible solution:

Rebase onto current main, preserve the isolated auxiliary-session cancellation and existing candidate-hello/heartbeat lifecycle, then rerun the focused browser suites and the recorded real relay scenario on the rebased head.

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

Yes, source-reproducible: current main’s deep doctor has no bounded extension-relay page-snapshot path, and the PR supplies a concrete real Chrome/MV3 withheld-response scenario.

Is this the best way to solve the issue?

Yes: a route-owned deadline propagated into the exact direct-CDP or auxiliary Playwright session is preferable to a global timeout that could disturb shared tabs or the active relay.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2a1eba771342.

Labels

Label justifications:

  • P2: This repairs a bounded browser diagnostic and snapshot reliability failure without evidence of a core-runtime outage.
  • merge-risk: 🚨 compatibility: The PR changes browser CLI loading and makes deep diagnostics avoid creating a blank tab when no selectable tab exists.
  • merge-risk: 🚨 session-state: Cancellation now retires synthetic page sessions and changes Playwright connection-attempt ownership.
  • merge-risk: 🚨 availability: The new deadline and cancellation paths can affect browser doctor and CDP connection completion if merged incorrectly.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records after-fix real Gateway, Chromium, MV3 extension, and direct-CDP fault-injection runs with bounded failure and preserved sibling-session behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records after-fix real Gateway, Chromium, MV3 extension, and direct-CDP fault-injection runs with bounded failure and preserved sibling-session behavior.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: The available shallow history records this commit as the current-tree boundary for the browser route and relay files, but does not preserve reliable feature provenance. (role: low-confidence current-tree history contact; confidence: low; commits: cd0a1235a30c; files: extensions/browser/src/browser/routes/basic.ts, extensions/browser/src/browser/extension-relay/relay-bridge.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve the current main conflict and rerun the focused browser tests plus the redacted real relay scenario on the resulting head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-04T18:26:02.176Z sha 60e8ffbb2b3c8bd1d5a771efbe221f418fa31ca5 :: needs real behavior proof before merge. :: none
  • reviewed August 4, 2026, 3:18 PM ET / 19:18 UTC sha unknown :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-04T20:22:01.550Z sha 44e271784dc0b6fbc3f711e61dd7f8e5709e7e39 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-05T00:25:41.621Z sha 44e271784dc0b6fbc3f711e61dd7f8e5709e7e39 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-05T07:36:59.332Z sha 44e271784dc0b6fbc3f711e61dd7f8e5709e7e39 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-08T04:47:37.389Z sha b8b190a6a2993525eb37d110834c1f95d3104030 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T05:06:17.449Z sha f1b65ebafb0cc9a4fb89f3fe412a2ea14137df44 :: needs real behavior proof before merge. :: [P1] Keep the active relay until replacement hello succeeds | [P1] Retain missed-pong relay retirement
  • reviewed 2026-08-10T05:59:25.638Z sha f1b65ebafb0cc9a4fb89f3fe412a2ea14137df44 :: needs changes before merge. :: [P1] Keep the active relay until replacement hello succeeds | [P1] Retain missed-pong relay retirement | [P2] Keep browser CLI imports cold

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 4, 2026
@zhangguiping-xydt zhangguiping-xydt changed the title fix(bug): extension relay healthy per doctor fix(browser): bound deep-doctor page snapshot diagnostics Aug 5, 2026
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed 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. labels Aug 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: blank-template Candidate: PR template appears mostly untouched. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 8, 2026
@clawsweeper clawsweeper Bot added 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. labels Aug 8, 2026
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Aug 10, 2026
@zhangguiping-xydt zhangguiping-xydt changed the title fix(browser): bound deep-doctor page snapshot diagnostics fix(browser): deep doctor hangs on stalled page snapshots Aug 10, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Aug 10, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: browser labels Aug 12, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation extensions: browser merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. triage: blank-template Candidate: PR template appears mostly untouched.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant