Repository navigation
fix(browser): preserve running browsers and locked profile data - #149354
Conversation
|
🦞👀 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. |
b8382f6 to
1a4d226
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: blocked before merge. Reviewed September 15, 2026, 5:44 PM ET / 21:44 UTC. ClawSweeper reviewWhat this changesThe browser plugin preserves slow running browsers, cancels pending probes during lifecycle changes, and verifies managed-browser ownership before resetting or deleting profile data. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful follow-up to the merged startup fix: current main still applies shorter readiness deadlines to running browsers. No actionable introduced defect was found, and the earlier WebSocket payload-limit finding is addressed. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s browser plugin receives browser-tool and Gateway requests and manages Chromium processes, profiles, and control connections. Its lifecycle owner coordinates readiness, cancellation, shutdown, and profile-data cleanup. flowchart TD
A[Browser operation request] --> B[Current requester admission]
B --> C[Profile lifecycle owner]
C --> D[HTTP and WebSocket readiness]
D --> E[Reuse or restart managed browser]
C --> F[Verify process and profile lock]
F --> G[Stop browser and release data]
F --> H[Preserve data and explain refusal]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +242, Tests +625, Docs +9. Total +876 across 23 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single lifecycle owner and the maintainer-documented lock-preservation tradeoff, with clear recovery guidance and ownership checks before destructive operations. Do we have a high-confidence way to reproduce the issue? Yes, from source: a browser that passes startup with 750ms readiness responses can fail the shorter subsequent probe and be restarted on current main. The regression test exercises that sequence; this read-only review did not run it. Is this the best way to solve the issue? Yes. Reusing the lifecycle owner and aligning owned-browser deadlines addresses the defect without another manager or configuration surface; uncertain lock ownership appropriately preserves data. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7450a11bd15c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer disposition of the two merge-risk items in the completed review:
These are accepted scope and validation decisions for this landing, not unresolved introduced-code findings. The review reports no correctness or security findings. Exact-head normal CI and native preparation passed for 1a4d226; the source and prepared tree remain unchanged. |
|
Merged via squash.
|
…claw#149354) * fix(browser): preserve running browsers and locked profile data * test(browser): bound diagnostic fixture WebSocket payloads
Related: #149284
What Problem This Solves
Fixes managed Chrome being restarted by the next operation after a slow but successful startup, and prevents profile lifecycle operations from acting on stale requests or moving data while browser ownership is uncertain.
User Impact
Slow healthy browsers keep their process and tabs. Stopping a profile cancels pending readiness work, while canceling one waiter does not cancel an admitted shared launch. Reset/delete stop a verified browser left by an earlier runtime before moving data; uncertain ownership preserves the profile and reports the next action.
Locks naming another hostname are preserved, including after a machine rename. Starting Chrome also leaves those locked preferences untouched. An operator must close the browser using that profile and verify the lock before retrying. Personal and attach-only browser ownership remains unchanged.
Why This Change Was Made
Keep launch and owned-browser operations on one readiness allowance, eliminate the duplicate discovery request on the owned path, and give the WebSocket handshake and health command separate deadlines. Carry lifecycle cancellation through discovery, readiness, and ownership probes; malformed advertised URLs now return a structured diagnostic.
The existing lifecycle owner now handles explicit stop/reset/delete cleanup, with typed stopped/absent/unverified outcomes and current-request admission immediately before mutation. Process matching rejects sibling directory prefixes and duplicate flags. Cleanup removes redundant timers, result construction, a defensive existence wrapper, and mock-only branch coverage; existing preference preservation has stronger tests.
Evidence
Browser suite: 3,280 passed, 45 skipped, across 199 passing test files.
node scripts/run-vitest.mjs extensions/browser/src/browser --reporter=dot.Real loopback HTTP/WebSocket fixtures prove independent phase budgets, cancellation during body/upgrade/command waits, socket cleanup, and malformed advertisements. The diagnostic and public-context cancellation regressions were demonstrated failing before their fixes.
Negative-control tests reproduced the second-launch regression, stale request admission (including a microtask boundary), missing cross-runtime cleanup, other-host lock misclassification, locked preference writes, sibling directory ownership confusion, and replacement-lock handling. The repaired cases pass; current-host dead/zombie recovery and shared-start cancellation contracts remain covered.
Changed-file typechecks, lint, formatting, plugin boundaries, dead exports, storage guards, and import-cycle checks passed. Independent review used complete owner/caller sources and its hostname-lock finding was fixed and regression-tested.
No production deployment, live overloaded-Gateway reproduction, or new Windows cross-runtime cleanup proof is claimed.
Exact-head normal PR CI passed for
1a4d2267526d18a9d5dffb2101f9864c236181f8; native preparation verified that same remote commit. Rebase onto current main preserved both browser patches exactly.Existing synthetic fixture refusals were repaired in ClawSweeper #1595. Native scanner admission passed on this complete committed browser range, including the unchanged patch context.
Additional hosted probe and limits
The broader hosted fallback was stopped after the required normal PR plan passed. It recorded a Matrix native-asset download connection reset and two Windows tooling issues: the fresh-worker build test exhausted its 120-second budget, and the Git checkout harness observed a registered process still alive at its completion boundary. The Git-owner fixture does not invoke browser runtime code; the broader Windows compilation timing was not isolated sufficiently to attribute it. These findings remain separate follow-ups and are not presented as passing Windows proof.