Repository navigation
Conversation
|
Codex review: needs changes before merge. Reviewed August 26, 2026, 5:22 AM ET / 09:22 UTC. ClawSweeper reviewWhat this changesThe PR lets Merge readinessKeep open: the rebased implementation resolves the prior pinned-CDP review concern, but it makes an existing lifecycle test call a helper absent from its shared Chrome mock, so the affected test suite will fail. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe browser plugin manages Chrome profiles for CLI and agent requests. A stop request serializes profile cleanup, then can recover a verified OpenClaw-owned local Chrome process that has no in-memory launch handle in the stopping runtime. flowchart LR
A[Browser stop request] --> B[Profile lifecycle transition]
B --> C[Clean registered handles]
C --> D[Verify managed local process]
D --> E[Pinned CDP close or guarded signal]
E --> F[Stopped result]
B --> G[Attach-only or remote profile]
G --> H[Disconnect only]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +70, Tests +149. Total +219 across 4 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep one lifecycle-owned recovery flow, add the missing shared test-harness export, and validate managed, attach-only, and replacement-process cases before merge. Do we have a high-confidence way to reproduce the issue? Yes. Current main lacks cross-runtime recovery, and source inspection shows the branch's new local-stop call reaches a missing export in an existing shared Vitest mock. Is this the best way to solve the issue? Mostly yes. The recovery is correctly placed inside the profile lifecycle and preserves pinned CDP lookup behavior; the test harness must be updated before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 33a24b6d8ea2. LabelsLabel justifications:
EvidenceAcceptance criteria:
What 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
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Added real macOS process-level evidence to the PR body: a managed Chrome launched by a separate agent runtime exits and loses its CDP listener after |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: NianJiuZst <[email protected]>
7ec1917 to
d9fff0f
Compare
Co-authored-by: NianJiuZst <[email protected]>
|
@clawsweeper re-review The contributor's owner-boundary fix is rebuilt and independently security-reviewed on current main; both signed commits retain @NianJiuZst's co-author credit.
Exact reviewed contributor-branch head: c0b383c. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* fix(browser): safely stop cross-runtime managed Chrome Co-authored-by: NianJiuZst <[email protected]> * test(browser): keep shared Chrome lifecycle mocks current Co-authored-by: NianJiuZst <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: NianJiuZst <[email protected]>
Closes #109678
What Problem This Solves
An OpenClaw-managed Chrome browser launched by an agent can belong to a different browser runtime than the one handling
openclaw browser stop. The stopping runtime has no retained child-process handle, so the stop operation reports failure while Chrome and its DevTools listener remain alive.Why This Change Was Made
Recover and stop the exact locally managed Chrome inside the existing serialized profile lifecycle transition. Process ownership requires the current-host profile singleton, live PID, configured browser executable, exact user-data directory and DevTools port, listening-socket ownership, process start identity, and matching browser-reported PID. The graceful DevTools socket retains the current DNS-pinned endpoint transport, then synchronously revalidates the complete process identity immediately before
Browser.close; signal escalation separately revalidates identity before every signal.Attach-only, remote, existing-session/Chrome-MCP, and browser-extension profiles never enter this managed-process recovery path. Existing retained process handles keep their canonical shutdown flow.
User Impact
openclaw browser stopnow shuts down an agent-launched managed Chrome even when another runtime owns its launch handle, while preserving personal, attach-only, and remote browsers.Evidence
main: the new cross-runtime stop test expectedstopped: truebut receivedstopped: false.OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs extensions/browser/src/browser/chrome.internal.test.ts extensions/browser/src/browser/chrome.test.ts extensions/browser/src/browser/cdp.helpers.internal.test.ts extensions/browser/src/browser/server-context.stop-running-browser.test.ts extensions/browser/src/browser/server-context.existing-session.test.ts— 150 passed, 1 skipped.OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs extensions/browser/src/browser/server-context.ensure-browser-available.waits-for-cdp-ready.test.ts extensions/browser/src/browser/server.agent-contract-form-layout-act-commands.test.ts extensions/browser/src/browser/chrome.internal.test.ts extensions/browser/src/browser/chrome.test.ts extensions/browser/src/browser/cdp.helpers.internal.test.ts extensions/browser/src/browser/server-context.stop-running-browser.test.ts extensions/browser/src/browser/server-context.existing-session.test.ts— 213 passed, 1 skipped, including both originally failing CI suites.OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs extensions/browser— 193 passed, 2 skipped test files; 2,727 passed, 6 skipped tests across the complete changed-browser CI shard.node scripts/run-tsgo.mjs -p extensions/browser/tsconfig.json --noEmit— passed.git diff --check— passed.The first exact-head CI run exposed two older shared Chrome test harnesses that had not yet exported the new lifecycle helper. Both canonical test doubles now model the no-owned-browser case directly; the production implementation and security invariants were unchanged, and the original failing suites plus the entire affected browser shard pass.
Real isolated macOS Chrome proof against the current implementation:
Both Chrome processes used temporary OpenClaw-owned profiles and randomly allocated loopback DevTools ports; all proof processes and temporary state were cleaned up. The managed-process recovery is currently available only on macOS and Linux, where existing executable, argument, process-start, and listener-ownership proof is supported.
Thanks to @NianJiuZst for the original owner-boundary fix and reproduction. Both repair commits preserve the contributor's co-author credit.