Repository navigation
Description
Summary
The managed openclaw browser profile loses all cookies / login sessions whenever the browser process, or the parent gateway that owns the Chrome child, restarts. This was reported and root-caused in #15645, which was auto-closed as stale, not fixed. It still reproduces on the latest release, so filing fresh per the closing note's request.
Root cause
Chrome driven over CDP does not flush cookies to its on-disk SQLite store; cookies live only in memory. Network.getAllCookies returns them in-session, but user-data/Default/Cookies stays at 0 rows and Default/Network/Cookies is never created. This is documented Chrome-via-CDP behavior; see chromedp/chromedp#818.
Reproduction (minimal)
openclaw browser start- Over CDP, set a persistent cookie with
Storage.setCookiesand a futureexpires, or log into any site in the managed profile. - Inspect
~/.openclaw/browser/openclaw/user-data/Default/Cookies-> 0 rows; noDefault/Network/Cookiesexists. - Even after a graceful
Browser.closewith Preferencesexit_type: Normaland a 45s in-flight wait, the cookie is absent from disk. - Relaunch the profile -> the cookie / login session is gone.
Evidence / scope
- History, Local Storage, and Session Storage do persist to disk for the same profile; only Cookies do not.
- Tested on Chrome 149.0.7827.156, macOS 26, OpenClaw 2026.6.10. Original [Feature]: Persist browser cookies/sessions across managed browser restarts (CDP cookie flush) #15645 saw the same on Chrome 144.
- Second trigger from [Feature]: Persist browser cookies/sessions across managed browser restarts (CDP cookie flush) #15645: the managed browser is a child process of the gateway, so every gateway restart (
SIGUSR1,config.patch, update) kills it, causing full session loss even without an explicitbrowser stop.
Impact
Any browser-SSO automation cold-starts every run and hits the SSO/MFA wall, so it cannot complete unattended.
Proposed fix
Implement CDP cookie save/restore as #15645 specified: on graceful stop and on a periodic flush, Network.getAllCookies -> a per-profile sidecar; on start, Network.setCookies to restore. The sidecar should be treated as sensitive profile state.
A working local patch already does this in the browser plugin's launch/stop lifecycle and survives both browser restarts and gateway restarts. Happy to open a PR if the maintainers want this upstream.
Refile of #15645.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 25, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 30, 2026, 5:43 PM ET / 21:43 UTC.
Summary
Keep open: current main and the latest release still launch a persistent managed Chrome user-data-dir but have no durable cookie snapshot/restore path, and the fresh live repro now shows the same cookie loss after managed browser restart on current main.
Reproducibility: yes. The issue discussion now includes an isolated current-main live repro with Storage.setCookies before restart and Storage.getCookies empty after relaunch, and current source confirms there is no durable cookie restore path.
Root-cause cluster
Relationship:
canonicalCanonical: #96704
Summary: This issue is the canonical fresh current-main report for managed-browser cookie/session loss; the older issue is stale-closed and the prior implementation PR is closed unmerged as the wrong shape.
Members:
superseded: [Feature]: Persist browser cookies/sessions across managed browser restarts (CDP cookie flush) #15645 - It reports the same managed-browser cookie/session loss but was closed by stale automation asking for a fresh latest-release repro.partial_overlap: feat(browser): persist login sessions across restarts #45371 - It attempted the same symptom with CDP cookie snapshots, but was closed unmerged because the branch was stale and the storage/security shape was not acceptable.partial_overlap: [Feature]: Built-in headless browser for reliable web access without external dependencies #53763 - It broadly tracks browser-backed web access and session persistence concerns, but it is a wider product tracker rather than the canonical cookie persistence bug.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
The issue is credible and well scoped, but existing labels and the prior PR review show the remaining blocker is maintainer/security product direction rather than a safe autonomous fix lane.
Security
Needs attention: This issue is security-sensitive because any durable fix may store or restore browser login cookies outside Chrome's normal profile database.
Review details
Best possible solution:
Keep this open for maintainer/security selection of a current-path managed-browser persistence design that preserves login cookies without default plaintext duplicate storage, then prove browser and gateway restart behavior.
Do we have a high-confidence way to reproduce the issue?
Yes. The issue discussion now includes an isolated current-main live repro with Storage.setCookies before restart and Storage.getCookies empty after relaunch, and current source confirms there is no durable cookie restore path.
Is this the best way to solve the issue?
Unclear. CDP Storage.getCookies/Storage.setCookies is a plausible mechanism, but the prior default plaintext sidecar approach was rejected; the best fix needs a maintainer-approved sensitive-storage and lifecycle design.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 3811001d2783.
Label changes
Label changes:
issue-rating: 🦀 challenger crab: Current issue advisory state selects this label.clawsweeper:current-main-repro: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.clawsweeper:needs-live-repro: Current issue advisory state no longer selects this label.issue-rating: 🐚 platinum hermit: Current issue advisory state no longer selects this label.Label justifications:
P1: Managed browser SSO workflows can lose login state on every browser or gateway restart, blocking real unattended browser automation.impact:data-loss: The report is about persistent browser cookies and login state disappearing across restarts.impact:session-state: The affected state is the managed browser session continuity that automation depends on.impact:security: A fix must handle browser login cookies, which are sensitive credential-like state.Evidence reviewed
Security concerns:
A CDP cookie snapshot can duplicate SSO cookies into OpenClaw-managed storage; prior review rejected a default plaintext sidecar, so a fix needs explicit sensitive-storage handling and maintainer/security approval.
Confidence: 0.91
What I checked:
extensions/browser/src/browser/chrome.ts:718, 3811001d2783)extensions/browser/src/browser/chrome.ts:1132, 3811001d2783)extensions/browser/src/browser/pw-tools-core.storage.ts:7, 3811001d2783)extensions/browser/src/browser/chrome.ts:720, e085fa1a3ffd)Likely related people:
extensions/browser/src/browser/chrome.ts,extensions/browser/src/browser/server-context.availability.ts,extensions/browser/src/browser/pw-tools-core.storage.ts)src/browser/session-persistence.ts,src/browser/chrome.ts,src/browser/server-context.availability.ts)extensions/browser/src/browser/chrome.ts,extensions/browser/src/browser/pw-tools-core.storage.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.TurboTheTurtle commentedon Jun 25, 2026
Correction to the proposed-fix note: the browser-level CDP cookie methods are
Storage.getCookies/Storage.setCookies, notNetwork.getAllCookies/Network.setCookies. TheNetwork.*variants are page-session only and return'Network.getAllCookies' wasn't foundon the browser-target WebSocket endpoint.A local implementation using
Storage.*has been validated end-to-end: snapshot on graceful stop plus a periodic flush, restore on launch, and a real multi-cookie SSO session survived a hard browser kill and relaunch.TurboTheTurtle commentedon Jun 25, 2026
Correction to the proposed-fix note above: the browser-level CDP cookie methods are
Storage.getCookies/Storage.setCookies, notNetwork.getAllCookies/Network.setCookies. TheNetwork.*variants are page-session only and return'Network.getAllCookies' wasn't foundon the browser-target WebSocket endpoint.A local implementation using
Storage.*(snapshot on graceful stop plus a periodic flush, restore on launch) has been validated end-to-end — a real multi-cookie SSO session survived a hard browser kill and relaunch.TurboTheTurtle commentedon Jun 30, 2026
Live repro on current
origin/main:2026.6.11 (44ec7580e2f)built locally from a clean temp worktreeopenclawprofileOPENCLAW_CONFIG_PATH/OPENCLAW_STATE_DIR, browser plugin only, profile at/private/tmp/openclaw-96704-home/state/browser/openclaw/user-dataSteps/results:
openclaw browser start --headless.Status reported
running: true,cdpReady: true,cdpPort: 19978, and the temp user data dir above.Storage.setCookiesfor a persistent synthetic cookie:name=oc96704_live_repro,domain=example.com, valuevalue-96704-live-20260630, futureexpires.Storage.getCookiesconfirmed the cookie was live in memory:{ "totalCookies": 1, "matchingCookies": 1, "matchingValues": ["value-96704-live-20260630"], "matchingDomains": ["example.com"] }No
Default/Network/Cookiesfile existed, and no OpenClaw cookie sidecar existed.openclaw browser stop; the same DB still had0cookie rows after shutdown.openclaw browser start --headless.Storage.getCookiesafter relaunch returned no cookies:{ "totalCookies": 0, "matchingCookies": 0, "matchingValues": [] }So the live behavior matches the report: the managed Chrome profile accepts the persistent cookie in-session, but current OpenClaw/Chrome does not write it to durable profile storage, and the session is lost on browser restart.
TurboTheTurtle commentedon Jun 30, 2026
@clawsweeper re-review
clawsweeper commentedon Jun 30, 2026
🦞🧹
ClawSweeper re-review requested.
I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow
sweep.yml, eventrepository_dispatch).Result: the existing ClawSweeper review comment will be edited in place when the review finishes.