fix(browser): prevent stale profile resurrection#104601
Conversation
|
Land-ready test/proof record for current PR head
Source-blind behavior contract: 7 passed, 1 failed. The failure is a separate existing product-surface mismatch: the advertised |
|
Codex review: stale review; fresh review needed. Summary Next step |
|
Merged via squash.
|
* fix(browser): serialize profile lifecycle * refactor(browser): tighten lifecycle cleanup * chore(browser): keep release note in PR * test(browser): keep temp fixtures inside plugin * test(browser): use preferred temp root
Closes #103784
AI-assisted; implementation and validation reviewed by the submitting maintainer.
What Problem This Solves
Fixes an issue where a browser start could finish after stop, reset, profile deletion, hot reload, or Gateway shutdown had already returned. That stale work could recreate browser state, retain an adapter, or leave an OpenClaw-managed child process behind.
Why This Change Was Made
Browser lifecycle ownership now lives in one per-profile actor: destructive transitions invalidate the current generation synchronously, cancel admitted work, and serialize exact-resource cleanup before later starts proceed. The refactor replaces the scattered promise and cleanup paths while preserving normal tab/action concurrency, managed-browser restart, remote CDP use, existing-session Chrome/Brave data, the extension relay, and attach-only browser ownership.
No browser config, Gateway protocol, storage shape, CLI flag, or plugin SDK surface changes. OpenClaw terminates only resources it owns; external browser processes are disconnected, never killed.
User Impact
Operators can stop, reset, delete, reconfigure, or shut down browser profiles without an earlier start resurrecting them afterward. Starting again after reversible stop/reset remains supported, and external or existing-session browsers stay alive.
Evidence
1f3e30a1d25; runtime reviewed/tested head:d670d655ac0. Later commits remove a release-owned changelog line and keep test temp fixtures inside the browser plugin boundary on the preferred OpenClaw temp root; runtime bytes are unchanged.autoreviewpasses reported no actionable findings after the lifecycle refactor and again after cleanup/lint hardening.gpt-5.4agent:ccc9c3e0-566f-4c10-bf60-eee571612d8emade two successful Browser calls and returnedMANAGED_OK Example Domain.78d15d64-a1e6-465f-9474-469aa6a18138created PID 62612, made three successful Browser calls, and returnedRESTART_OK Example Domains.07956581-4790-4e15-bdbe-653e67eca28fmade four successful Browser calls and returnedEXTERNAL_OK Example Domain; the external process exited only during explicit validator cleanup.openai, modelgpt-5.4,fallbackUsed: false, and zero Browser-tool failures. Targeted validator-artifact scanning found no credential patterns.reset-profileCLI is rejected by the Gateway's persistent-profile mutation boundary before this lifecycle code runs. Direct reset/race regression tests pass; the CLI boundary needs a separate trust-model decision and is not weakened here.