Skip to content

desktop(browser): session cookies not persisted in v2.2.0 (upgrade to v2 did not fix #50382) #60313

Open

Description

@jijoyo

Summary

Session cookies and authentication state are NOT persisted across OpenCode Desktop restarts in v2.2.0. The embedded browser's cookie store remains frozen at its initial state — no cookies, localStorage session data, or IndexedDB writes survive app restarts. This is the same bug as #50382, which was closed with upgrade to v2 advice, but the bug still exists in v2.2.0.

Environment

  • opencode version: 2.2.0 (Desktop app); CLI: 1.18.35
  • OS: Linux 6.12.113+deb13-amd64 (Debian 13 trixie)
  • Shell: /bin/bash
  • Install/channel: latest release (installed to /opt/OpenCode)
  • Active plugins: /home/israel/.opencode/plugins/browser-persistente (V2 local)
  • Config: ~/.config/opencode/opencode.jsonc (V2 format, key "plugins")

Reproduction

  1. Open OpenCode Desktop v2.2.0
  2. Use the built-in "Navegador" panel (browser pane) to visit any login-protected site (e.g., agensi.io, github.com)
  3. Complete login, confirm the page shows authenticated content
  4. Fully quit OpenCode Desktop (close app)
  5. Reopen OpenCode Desktop
  6. Navigate to the same site in the browser pane

Expected Behavior

The user should remain logged in. Session cookies should persist in the browser profile directory and the site should show the authenticated state.

Actual Behavior

The user is logged out. Every restart requires re-login. Evidence:

  • ~/.config/ai.opencode.desktop/Cookies file is frozen at profile creation time (2026-09-04 in this case, 20480 bytes) — never written to during any session
  • ~/.config/ai.opencode.desktop/Partitions/ directory does not exist — ephemeral UUID partition is still being used (as described in #50382)
  • No Cookies-wal file is ever created despite successful logins

This matches the exact pattern from #50382: Network/Cookies SQLite DB stays frozen at launch-time size, no WAL/journal activity.

Additional Context

  • #50382 was closed by thdxr on Oct 11 saying OpenCode 2.0 is now out — but the reporter (Tomflame-4ever) confirmed in a comment that the same bug reproduces on v2.0.12
  • Fix PR exists: #53453 by 4Liberty (merged Oct 5) — switches from opencode-browser-${crypto.randomUUID()} ephemeral partition to partition: "persist:opencode-browser"
  • The PR description says: Verified Electron session persistence: session cookies and Local Storage are successfully retained across app restarts in Partitions/opencode-browser
  • However, v2.2.0 (released Oct 27) still ships with the broken ephemeral partition behavior — the PR fix was not included in v2.2.0 release
  • The Partitions/ directory is absent from the profile (confirmed on this machine)
  • Alternative workaround tested: opencode-browser-plugin (Playwright with launchPersistentContext to ~/.opencode/browser-profile) works for cookie persistence, but this is a separate browser instance, not the integrated pane

Impact: Every user who relies on the integrated browser pane for authenticated workflows (GitHub, Agensi, GitLab, etc.) loses all session state on every restart. This is a significant UX regression for a core feature.

Activity

  1. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. We couldn't reproduce this in our automated environment because it can't run the OpenCode Desktop app, so a maintainer with the Desktop app will need to confirm it.

    The code does point to a likely cause, though we haven't confirmed it by running the app. On both v2.2.0 and the latest dev (1eea2d4), the built-in browser pane gets a new, temporary storage area each time it's set up, so cookies stay in memory and are lost when the app closes. That fits what you saw: the Cookies file is never written and there's no Partitions/ folder.

    One correction: #53453, the PR that would make the browser storage persistent, hasn't been merged yet. It's still open, which is why the fix isn't in v2.2.0.

    Related:

  2. kernelKain commented on Nov 3, 2026

    @kernelKain

    Still reproduces on v2.2.5 (Desktop)

    Same symptom as the original report, on a current build. Confirmatory data point, not a new bug:

    • opencode: Desktop 2.2.5 (CLI 2.2.5), installed at /opt/OpenCode
    • OS: Ubuntu, Linux 7.0.0-38-generic x86_64
    • Plugins: @tarquinen/opencode-dcp, opencode-mem, local ./plugins/usage (none touch the browser)

    Repro: open a Google-authenticated console (OpenRouter / OpenCode Console / Kimi / Gemini) in the browser pane → sign in → quit the app → reopen → navigate back → signed out, and every one of those consoles asks for Google sign-in again.

    Evidence:

    • ~/.config/ai.opencode.desktop/Cookies — 20,480 bytes, 0 rows, mtime frozen at profile creation (2026-10-05). Still no Partitions/ directory.

    • The bundle confirms the cause is unfixed in 2.2.5. resources/app.asar still contains:

      partition: `opencode-browser-${crypto.randomUUID()}`,
      ...
      ct.session.fromPartition(C.partition).webRequest.onBeforeRequest(...)

      No persist: prefix, and the partition name is regenerated per browser connection, so the session is in-memory by construction. Same root cause the maintainer comment above describes.

    • Control case on the same machine: Chrome's profile has 3,260 cookies including a valid .google.com SID/SSID/SAPISID, so this is specific to the embedded browser, not expiring Google sessions.

    Blocker check: the fix PR #53453 (opencode-browser-${crypto.randomUUID()} → persist:opencode-browser) is still open and currently mergeStateStatus: DIRTY (last push 2026-10-10), so it hasn't landed between 2.2.0 and 2.2.5. That PR looks like the whole fix.

    One caveat worth testing after #53453 merges: Google's OAuth rejects embedded user agents in some flows (disallowed_useragent), so a persistent partition may still not fully restore Gmail SSO inside the pane. That doesn't affect the general cookie-persistence bug, but it does affect whether "stay signed in to Google consoles" is fixable in-app or needs a real browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions