Skip to content

Windows Desktop loses all session history after restart, but sessions still exist in opencode.db #17765

@1401341324

Description

@1401341324

Description

Description
On Windows Desktop, all session history disappears every time I close and reopen OpenCode.

This is not just a UI refresh issue. After reopening the client, the session list is completely empty.

However, I checked the local database and confirmed that the sessions are still stored locally, so the data does not appear to be deleted. This looks like a session loading / project matching / indexing bug on startup.

Environment
OpenCode version: 1.2.27
OS: Windows
Client: Desktop
Workspace type: local Windows directory
Path usage: fixed / consistent path, not switching between different path formats
WSL: not using WSL for this case
Steps to reproduce
Open OpenCode Desktop on Windows
Open a local project directory
Create or use some sessions normally
Close OpenCode Desktop
Reopen OpenCode Desktop
Observe that the session history list is now empty
Expected behavior
Previously created sessions should still appear in the session/history list after reopening the app.

Actual behavior
After reopening the app, the session/history list is completely empty.

Important local findings
I inspected the local database at:

C:\Users\14013.local\share\opencode\opencode.db

The database still contains session data:

project: 1
session: 11
message: 100
Relevant findings:

session table exists and contains records
message table exists and contains records
storage/session_diff/ also contains files matching the session IDs
But the data shape looks suspicious:

the only row in project is:
id = global
worktree = /
all session rows have:
project_id = global
directory = D:
So the persisted session data is still there, but the project/worktree mapping looks inconsistent on Windows:

project.worktree = "/"
while session.directory = "D:"
This makes me suspect that after restart, Desktop cannot match/load the existing sessions correctly, so the UI shows an empty list even though the data still exists.

Additional notes
This is on a local Windows directory
I am not changing paths
I already updated to the latest version available to me (1.2.27)
The problem happens consistently after closing and reopening the client
Possible root cause
This may be related to Windows-specific path normalization / project matching / session indexing on startup.

Plugins

ohmyopencode

OpenCode version

1.2.27

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)webRelates to opencode on web / desktopwindows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions