Skip to content

fix(session): Windows session list empty when directory uses forward slashes #30374

Description

@XJPeng12

Description

Description

On Windows, new sessions persist directory with backslashes (e.g. E:\smart_database), while the web app and HTTP API often pass directory with forward slashes (e.g. E:/smart_database from URLs or the SDK).

Session list filters use exact string equality on SessionTable.directory, so requests like GET /session?directory=E:/smart_database&roots=true return [] even when matching rows exist in SQLite. The sidebar session list appears empty for that project.

Expected behavior

Session list returns sessions regardless of whether the query path uses / or \ on Windows.

Actual behavior

Forward-slash and backslash forms of the same Windows path do not match; session list is empty.

Reproduction

  1. On Windows, create sessions in a project (directory stored as E:\smart_database)
  2. Query sessions via web app or API with directory=E:/smart_database
  3. Observe empty session list despite sessions existing in the database

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

win10

Terminal

No response

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