Repository navigation
fix(browser): preserve shared Chrome tabs during tracing and reconnects - #132485
Conversation
Preserve the reviewed browser repair candidate before refreshing main and finalizing the private Gateway configuration SDK boundary. Validation and real browser proof remain pending; this checkpoint is not a land-ready claim.
Use a private Gateway config runtime facade for bundled port lookups while preserving the shipped public core export. Keep private declarations out of the package and finish the relay auth-test cleanup check.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 4:52 AM ET / 08:52 UTC. ClawSweeper reviewWhat this changesThe PR preserves an already-authorized Chrome tab through a trace-reset navigation and reconnect, while keeping separate CDP clients’ runtime sessions isolated. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer handling: current main still denies the existing-tab Priority: P1 Review scores
Verification
How this fits togetherThe browser plugin relays authenticated CDP commands through Chrome debugger attachments. Its tab-access policy decides whether a tab remains usable before the relay returns commands and debugger events to MCP or other CDP clients. flowchart LR
Clients[CDP and MCP clients] --> Relay[Authenticated browser relay]
Relay --> Access[Tab access policy]
Access --> Provenance[Document provenance checks]
Provenance --> Debugger[Chrome debugger attachment]
Debugger --> Tab[Authorized Chrome tab]
Debugger --> Relay
Relay --> Clients
Decision needed
Why: The PR intentionally changes the authenticated browser authority boundary and carries the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource +1070, Tests +1850, Docs +20, Config +7, Other +2. Total +2949 across 51 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the bounded owner-level transition only after maintainer acceptance and exact-head required checks, retaining the same-tab, same-attachment, same-connection, root-frame, loader, and revocation checks. Do we have a high-confidence way to reproduce the issue? Yes: current-main source rejects the blank document during the reported CDP sequence, and the submitted real Chrome/MCP trace covers the same flow in both access modes. Is this the best way to solve the issue? Yes, provisionally: the exception is owned by tab-access provenance rather than a global blank allowlist or client-specific workaround, but acceptance of the authority change remains a maintainer decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1e42dbc945f2. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Maintainer review / landing decision under the requested fix-and-land scope: accept the bounded existing-tab transition implemented here. The supported exception requires an already-proven attached tab, an authenticated root-session command to exact I read the current live ClawSweeper review and its Rank-up moves, as well as the other live acknowledgement. The two requested moves are addressed by that bounded authority decision and this explicit review of the current comments; there is no additional unread actionable move in the other live comment. The positive production delta is accepted for the three missing document, physical-attachment and logical-client owners, with the old parallel attach/session machinery removed and the real ordering/revocation tests treated as part of the repair. The stored-data-model warning does not indicate a persistent migration: three named files are test support, and The first CI run exposed a stale package-script expectation, not a runtime failure. The focused correction updates only the test title and complete expected command to include the required native-host build. Exact-head CI must be green before the native prepare/merge flow proceeds; no bypass is requested. |
|
Land-ready verification for 1dbca958c08233ef22cebd522f8e7471907e29d9: exact-head CI 33243830680 and Workflow Sanity 33243830672 completed successfully. The newest exact-head ClawSweeper review has no correctness/security finding. Its maintainer-acceptance and completed-checks Rank-up move is covered by the existing maintainer decision and these green checks; the documented authority fences remain unchanged. All 49 live-tested browser/runtime/package files remain byte-identical. The later test corrections passed The prior 49-path changed gates, canonical builds, package inventory, complete real Linux Chrome bootstrap/native test and six-case tracing proof remain applicable—not newly rerun. They cover both-mode default traces with exact URL return, mixed-client snapshots across reconnect, recording disposal on pause/transport loss and native target closure. Browser proof remains Linux/aarch64; autoreview clearance remains P0-scoped. Existing Fetch/late-child follow-ups remain separate. Native |
|
Merged via squash.
|
Bind Fetch requests and streams to their logical owner, project child sessions per interested parent, and keep native cleanup failures local and explicitly recoverable. Hold pending attachment claims through announcement, reject target substitution, and require complete native-to-Playwright tab projection. Preserve the Runtime, controlled-document, tracing and creation foundation from PR #132485. Keep main's navigation-matrix ownership and adapt four current-schema test expressions to the canonical agent schema version so the unrelated CI failure is repaired without changing database behavior or schema. Related: #132484.
Bind Fetch requests and streams to their logical owner, project child sessions per interested parent, and keep native cleanup failures local and explicitly recoverable. Hold pending attachment claims through announcement, reject target substitution, and require complete native-to-Playwright tab projection. Preserve the Runtime, controlled-document, tracing and creation foundation from PR #132485. Keep main's navigation-matrix ownership and adapt four current-schema test expressions to the canonical agent schema version so the unrelated CI failure is repaired without changing database behavior or schema. Related: #132484.
…ts (openclaw#132485) * fix(browser): preserve controlled document navigation authority * fix(browser): checkpoint relay lifecycle and cold-start repair Preserve the reviewed browser repair candidate before refreshing main and finalizing the private Gateway configuration SDK boundary. Validation and real browser proof remain pending; this checkpoint is not a land-ready claim. * fix(browser): isolate native bootstrap configuration imports Use a private Gateway config runtime facade for bundled port lookups while preserving the shipped public core export. Keep private declarations out of the package and finish the relay auth-test cleanup check. * test(browser): align bootstrap script contract with native build * test(voice-call): await notification hangups before teardown
…law#132504) Bind Fetch requests and streams to their logical owner, project child sessions per interested parent, and keep native cleanup failures local and explicitly recoverable. Hold pending attachment claims through announcement, reject target substitution, and require complete native-to-Playwright tab projection. Preserve the Runtime, controlled-document, tracing and creation foundation from PR openclaw#132485. Keep main's navigation-matrix ownership and adapt four current-schema test expressions to the canonical agent schema version so the unrelated CI failure is repaired without changing database behavior or schema. Related: openclaw#132484.
Closes #132220 — default performance tracing strands an existing shared Chrome tab at
about:blank.Related: #132232 — the already-landed atomic new-page creation repair reused here; #128379 — separate standalone relay startup work, not taken over by this PR.
What Problem This Solves
Fixes an issue where users recording a default Chrome DevTools MCP performance trace would lose access to their existing shared tab when the client temporarily navigated it to
about:blank. The trace failed before recording and left the tab blank. A second real failure appeared when Playwright connected before MCP: a fresh snapshot produced element refs that a labeled screenshot could not resolve because the later client never received the page’s existing execution context.This is source/main behavior, not a claimed shipped-stable regression. The original new-tab creation failure is already fixed by #132232; this PR keeps that canonical atomic creation flow.
Why This Change Was Made
The extension now owns an exact commanded blank-document transition, confirmed by native root-frame/loader evidence on the same authorized tab, attachment and connection, while the relay separates each client’s logical Runtime subscription from the physical debugger lifetime. This preserves ordinary blank/internal-page denial, incognito/current/pending URL checks, pause/group boundaries and SSRF, and avoids resetting healthy sibling clients just to replay execution contexts.
An existing-tab transition never gains deletion or URL-restoration authority; physical attachments retire before a replacement connection uses them, and explicit close lets Chrome destroy the WebContents/debugger together. The native bootstrap also uses a narrow private Gateway config facade instead of importing the broad SDK core barrel solely for port resolution; the shipped public core export and canonical resolver remain unchanged.
User Impact
Default performance tracing works on existing eligible tabs in both All tabs and Selected tabs modes. Fresh snapshot refs work when OpenClaw and an external CDP client are connected together, including after an extension reconnect. The clients still share page state, so navigation can invalidate another client’s snapshot: take a fresh snapshot after reconnecting.
No new setting or migration is required. There is no dependency, public SDK budget, storage schema or protocol-version change. No account login, operator Gateway restart, real-profile reconfiguration, Store publication or release was performed.
Evidence
Real Chrome and official MCP
Proof used a disposable local Linux/aarch64 container, no host mounts/credentials/state or published ports: Node 24.18.1, Chromium 151.0.7922.34, Playwright 1.62.1, official Chrome DevTools MCP 1.8.0 with bundled Puppeteer 25.8.0. All 345 official package files matched the published payload before/after every scenario; no dependency bytes were changed and no
latestsubstitute ran.f93be5b5fe56be6293a5517bd57ddcc135375fdaPage.navigatedenial; both direct Page and native Chrome Tab wereabout:blank, non-incognito, and hidden from relay discovery.NAVIGATION_0; returned to the exact original#sectionURL; unrelated tab unchanged.close_pagesucceeded; Page closed and native target disappeared.Aggregate six-case controller: passed, one expected historical failure plus five candidate successes, 127.72s. Every selected case verified MCP/browser closure and temporary runtime/IPC removal; independent process inventory found no remaining browser/MCP processes. The exact owned containers were removed.
The full pinned Chrome bootstrap flow also passed (22.11s test body): real auto-pairing, All/Selected creation and same-target snapshots, created-page closure, mixed Playwright/MCP labeled screenshots before/after actual reconnect, navigation recovery preserving the intended and unrelated tabs, native launcher probes, pause, version diagnostics and unpair. This was an artifact copy of the committed fixture with only Linux path/provenance adaptations and the existing
mcpCommandprofile option selecting the verified package; all assertions and the original 120s deadline stayed intact. The native-host test separately passed with its original 10s child deadline.Images attached below show only inspected synthetic fixtures. They show page state; the structured assertions above establish URL identity, revocation, trace parsing and target removal. The explicit-close capture is before deliberate close, not standalone closure proof.
Regression and static proof
Failing-before regressions cover both-mode existing-tab blank navigation, native admission before late Runtime replay, and explicit close of the controlled blank. Canonical main creation/navigation suites remain; distinct pre-callback and takeover cleanup races are retained rather than restoring a second creation implementation.
node scripts/check-changed.mjs -- <all 49 candidate paths>: passed, including all typecheck lanes, lint, SDK/architecture/dead-export guards, formatting and package-lock validation.pnpm build: passed locally and in the isolated Linux container. No ineffective dynamic-import warning.npm pack --dry-run --json --ignore-scripts: runtime JS included, private declaration excluded; the canonical release-check forbidden-path owner returned zero forbidden paths over 10,967 packed files. This is package-boundary proof, not a release.Initial exact-head CI run found a stale package-script expectation: it omitted the new build prerequisite needed by the compiled native-host fixture. The existing contract test now requires that ordering and retains the entire Chromium command assertion; all 51 package-script tests pass. This correction changes only that test’s title/expected command; runtime, package and live-proof inputs are unchanged.
The replacement CI run exposed a separate test-lifecycle leak: four voice-call notification tests returned while real three-second auto-hangup callbacks remained pending. Those callbacks later persisted/logged after the shared worker cleared their runtime, including during the store tests; Vitest then reported three pending-console-RPC teardown rejections despite all 721 assertions passing. The test-only repair joins the existing carrier hangup and verifies persisted terminal state. A frozen-order, real-resource probe failed before with 4 escaped callbacks, then passed with 0; the normal 63-file/721-test shard, changed-file gate and fresh P0-scoped autoreview pass afterward. The exact Linux RPC timing was observed in CI, not reproduced locally; the escaped producer and its removal were reproduced directly. No production code, logs, timers, environment or timeout budget was changed or suppressed.
Useful committed-test command:
The baseline comparison initially overfit the
access was revokedwording; the final check also accepts the other existingrestricted or unavailablebranch only with the exact same-tab native/direct blank state and relay denial. An earlier macOS filesystem-fenced full run stopped because the systempscould not execute inside the fence; no sandbox exception was added. Linux supplied the complete browser proof. An earlier SDK public-export attempt exceeded the budget and was replaced with the private facade; a real pack check caught its missing declaration exclusion. Final gates pass without larger limits, bypasses or weakened assertions.Scope and ownership
Production: +1,212/-449 (net +763). Tests/support: +2,430/-276 (net +2,154). Tooling/manifest metadata net +6, generated declaration mappings +6, docs +20. Production growth buys three missing owners—commanded-document provenance, physical socket attachment retirement, and logical session/Runtime subscriptions—while deleting the old parallel attach/session-routing machinery. A global blank allowlist, forced Runtime reset, tracing-specific protocol rewrite or silently disabling trace reload would not preserve the required contracts.
Separate follow-ups remain for cross-client Fetch ownership and late-client pre-existing child-target state; this PR does not promise complete CDP virtualization. A generator follow-up is recorded for synchronizing private declaration package exclusions; this PR supplies and verifies its required manifest entry. A separate fixture-lifetime follow-up records longer-lived conversation max-duration timers; the CI repair here closes the demonstrated notification callbacks, not a broader production CallManager shutdown design.
Docs: https://docs.openclaw.ai/tools/chrome-extension and https://docs.openclaw.ai/plugins/sdk-subpaths