Skip to content

Session history lost after v1.15.11 -> v1.15.12 upgrade (data persists in 627MB opencode.db) #29855

Closed as not planned

Description

@88lin

Description

After upgrading from v1.15.11 to v1.15.12 on Windows, existing session history is no longer visible correctly.

The session records themselves still appear to exist, but when I open most old sessions, the conversation is truncated and usually only the first message is shown. The local database is still large (%USERPROFILE%\.local\share\opencode\opencode.db is about 627MB), so this looks more like a read/routing/regression issue than actual data deletion.

What I see locally

%USERPROFILE%\.local\share\opencode\opencode.db: about 627MB

%USERPROFILE%\.local\share\opencode\storage\ currently looks almost empty for some JSON-backed directories:

Path Actual
storage/session/ 0 files, empty directories only
storage/message/ 1 file, 607 bytes
storage/part/ 4 files
storage/session_diff/ 436 files, still present

I am not sure whether the empty storage/session, storage/message, and storage/part directories are expected after SQLite migration. The important part is that the SQLite DB still appears to contain substantial data, but old sessions are no longer rendered with their full message history after the upgrade.

Suspected regression area

The most relevant change I found in v1.15.12 is PR #29640:

fix(server): use persisted session directory for existing-session routes

It changes planRequest() in packages/opencode/src/server/routes/instance/httpapi/middleware/workspace-routing.ts so existing-session routes prefer the persisted session.directory:

 function planRequest(
   request: HttpServerRequest.HttpServerRequest,
-  sessionWorkspaceID?: WorkspaceID,
+  session?: Session.Info,
 ) {
   ...
-  return RequestPlan.Local({ directory: defaultDirectory(request, url), workspaceID: envWorkspaceID ?? workspaceID })
+  return RequestPlan.Local({
+    directory: session?.directory || defaultDirectory(request, url),
+    workspaceID: envWorkspaceID ?? workspaceID,
+  })
 }

And routing now does:

const sessionID = getWorkspaceRouteSessionID(requestURL(request))
const session = sessionID
  ? yield* Session.Service.use((svc) => svc.get(sessionID)).pipe(
      Effect.catchIf(...NotFoundError..., () => Effect.succeed(undefined)),
      Effect.catchDefect(() => Effect.succeed(undefined)),
    )
  : undefined
const plan = yield* planRequest(request, session)

The test added with #29640 covers the intended prompt case: if a prompt is sent to an existing session while the request contains a different ?directory=, the prompt should run in the persisted session directory.

However, it does not appear to cover older persisted sessions on Windows where session.directory may be stale, differently normalized, no longer exists, or differs from the current request directory/header because of path formatting (C:\Users\... vs C:/Users/..., casing, symlinks, moved folder, etc.).

My concern is that read-only existing-session routes such as message/history loading may now be routed using session.directory instead of the request directory. If that persisted directory is not resolvable to the same instance/workspace on Windows, the server can look in the wrong place and return an incomplete session/messages view. That would match the symptom: sessions are visible, but their full conversation history does not load.

Why this may be Windows/path-related

This happened immediately after v1.15.11 -> v1.15.12.

The new behavior depends on the persisted session.directory string. On Windows, small path representation differences are common:

Current/request path Persisted path variant
C:\Users\Computer\Documents\GitHub\mytest C:/Users/Computer/Documents/GitHub/mytest
same path with different casing same path with original casing
current project path after move/rename old persisted path

If workspace/instance resolution treats these as distinct, old sessions can be routed to the wrong local instance or storage scope.

Steps to reproduce

  1. Use OpenCode v1.15.11 on Windows with extensive historical session data.
  2. Upgrade to v1.15.12.
  3. Open OpenCode from the same project folder.
  4. Open old sessions from history.
  5. Most old conversations show only the first message instead of the full message history.
  6. Check %USERPROFILE%\.local\share\opencode\opencode.db; the DB is still large (627MB in my case).

Expected behavior

Old sessions from v1.15.11 should continue to load their full conversation history after upgrading to v1.15.12.

Actual behavior

Most old sessions only show the first message. The rest of the conversation appears missing from the UI even though the local SQLite database is still large.

Possible useful regression tests

It may help to add coverage for existing-session read routes, not only prompt writes:

  1. Create a persisted session with multiple messages in one directory.
  2. Simulate opening/loading that session with a request directory/header that points to the same Windows path but uses a different representation (\\ vs /, casing differences, etc.).
  3. Assert that session.messages/history still returns the full message list.
  4. Simulate a stale session.directory and assert the route either falls back safely or returns a clear error instead of silently showing a truncated history.

Plugins

None

OpenCode version

v1.15.12, upgraded from v1.15.11 on May 28, 2026 evening

Operating System

Windows 11 (win32)

Terminal

Windows Terminal

Screenshot and/or share link

N/A

Activity

  1. github-actions commented on May 29, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is the same, please consider adding a comment there instead to help consolidate the discussion.

  2. changed the title [-]Session history lost after upgrading from v1.15.11 to v1.15.12 (opencode.db 627MB intact)[/-] [+]Session history lost after v1.15.11 -> v1.15.12 upgrade (data persists in 627MB opencode.db)[/+] on May 29, 2026
  3. github-actions commented on Jul 29, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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