Skip to content

[Bug]: Managed browser cookies never persist to disk (in-memory only) — login sessions lost on every browser/gateway restart (reproduces on 2026.6.10; refile of #15645) #96704

Description

@TurboTheTurtle

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)

  1. openclaw browser start
  2. Over CDP, set a persistent cookie with Storage.setCookies and a future expires, or log into any site in the managed profile.
  3. Inspect ~/.openclaw/browser/openclaw/user-data/Default/Cookies -> 0 rows; no Default/Network/Cookies exists.
  4. Even after a graceful Browser.close with Preferences exit_type: Normal and a 45s in-flight wait, the cookie is absent from disk.
  5. Relaunch the profile -> the cookie / login session is gone.

Evidence / scope

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

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:current-main-reproClawSweeper found a high-confidence current-main issue reproduction.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦀 challenger crabExceptional issue quality: high-confidence current-main reproduction and actionable evidence.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions