Repository navigation
fix(browser): keep snapshot refs bound to their captured controls - #153597
Conversation
Keep native DOM bindings tied to their captured controls, fence canceled snapshot writes, and preserve visible descendants under ignored AX roots. Consolidate snapshot capture under the existing role snapshot owner. Keep MCP labels scoped to their documents, finish cleanup before publishing, and discard ambiguous cross-document IDs. Retire refs before every snapshot refresh, including hidden and failed captures. Preserve healthy sibling connections during tab closure, ignore superseded extension bootstrap timeouts, deliver node timeout diagnostics through the CLI, and recheck node access before browser actions.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. ClawSweeper will not retry this unchanged revision. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
|
@clawsweeper re-review The exact synthetic browser fixture qualification is now on ClawSweeper main via openclaw/clawsweeper#1620. The canonical complete-range scan admits this head and still rejects a one-byte fixture mutation. The browser head and proof in the PR body are unchanged. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: blocked before merge. Reviewed September 20, 2026, 12:59 PM ET / 16:59 UTC (Revision 2). ClawSweeper reviewWhat this changesThe browser plugin preserves captured control identities, prevents canceled snapshots from replacing newer refs, cleans up iframe labels, preserves healthy tab connections, and improves timeout diagnostics and node-access checks. Merge readiness⛔ Blocked before merge - 2 items remain The PR remains useful and has no identified blocking code findings. The maintainer’s explicit acceptance resolves the previous compatibility decision; the unchanged head does not need another approval of those same tradeoffs. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s browser plugin turns agent and CLI requests into browser snapshots, screenshots, and actions through Playwright or Chrome MCP. Snapshot refs connect subsequent actions to the controls captured on a particular tab. flowchart TD
A[Agent or CLI request] --> B[Profile and node access checks]
B --> C[Browser snapshot capture]
C --> D{Identity and capture still valid?}
D -->|Yes| E[Bound control refs]
D -->|No| F[Error and fresh snapshot guidance]
E --> G[Browser action or labeled screenshot]
G --> H[Cleanup and result]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +237, Tests +1403, Docs +12. Total +1652 across 46 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the accepted identity-preserving behavior, target-scoped ref retirement, and documented recovery paths under the existing browser owners. Do we have a high-confidence way to reproduce the issue? Yes: current-main fallback and timeout paths establish concrete failure mechanisms, and the branch supplies focused Chromium regressions and reported before/after observations. This read-only review did not execute them. Is this the best way to solve the issue? Yes: the patch repairs the existing capture and routing owners, removes the parallel AI snapshot helper, and follows the maintainer-approved response to the dependency’s UID limitation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ff004d36052c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review The PR body now records the disposition of both compatibility risks: retain explicit rejection of ambiguous cross-document MCP IDs and require fresh refs after snapshot refreshes, including condition waits and failed captures. These preserve the original-control and latest-snapshot contracts; preserving the old aliases cannot preserve their identity. The managed-profile alternative and the unmeasured real-site prevalence are explicit. The head and runtime proof are unchanged, and there were no actionable code findings. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…enclaw#153597) * fix(browser): preserve snapshot identity through canceled captures Keep native DOM bindings tied to their captured controls, fence canceled snapshot writes, and preserve visible descendants under ignored AX roots. Consolidate snapshot capture under the existing role snapshot owner. Keep MCP labels scoped to their documents, finish cleanup before publishing, and discard ambiguous cross-document IDs. Retire refs before every snapshot refresh, including hidden and failed captures. Preserve healthy sibling connections during tab closure, ignore superseded extension bootstrap timeouts, deliver node timeout diagnostics through the CLI, and recheck node access before browser actions. * test(browser): preserve request budgets in CLI timeout assertions
What Problem This Solves
Fixes browser inspection and actions that time out, use stale element refs, or leave labels behind when tabs close, controls disappear, or captures overlap cancellation.
User Impact
Browser actions retain the captured element identity, healthy tabs keep their connection when another tab closes, and CLI callers receive the browser timeout diagnostic. Node requests retain their selected profile and recheck access before acting.
Chrome MCP can emit ambiguous element IDs across renderer documents. Affected snapshots now fail with a managed-profile alternative; ref-free screenshots still work. This change does not upgrade or patch Chrome MCP.
Why This Change Was Made
The snapshot paths now share one implementation and validate capture lifetime and document identity before changing or publishing refs. Ignored accessibility wrappers retain their visible descendants. Labeled MCP captures group work by document and finish cleanup before reporting success.
Related: #153420.
Compatibility Decisions
The two compatibility risks raised in review are accepted for this repair:
These are intentional corrections to element identity and ref lifetime within the requested browser repair. Existing Chromium and snapshot-identity regressions cover rejection, refresh failure, wait behavior, and sibling-tab isolation. No API shape, configuration option, or dependency version changes.
Evidence
595 tests passed across 26 files, including 61 real Chromium cases. The live cases check actual element identity, cancellation after a delayed CDP response, same-process and cross-process frames, ignored accessibility roots, label cleanup, and screenshot geometry. The full browser CLI suite also passes 267 tests, including the sibling transport-budget assertions exercised by CI. The final protocol-fixture correction passed its 17 owning unit tests and production/test typechecks.
The complete changed-file gate passed; the final navigation fix and CLI test correction passed their selected-file gates. Independent review is clean through P2 for the complete production diff and the CLI follow-up.
The supported CLI → Gateway → node → Chromium flow reproduced a generic Gateway timeout before the fix. With the fix, the same 1,000 ms request returned the detailed browser timeout and recovered on the same tab. The isolated Testbox and its browser processes were stopped afterward.
Synthetic iframe label cleanup, captured after each operation:
These images prove same-process iframe cleanup; cross-process ref ambiguity is covered by separate rejection and screenshot tests.