Skip to content

[BUG][Windows][Web/Desktop] Session sidebar uses path-sensitive exact matching (slash + drive-case), causing hidden sessions and duplicate workspaces #14570

@EgilSandfeld

Description

@EgilSandfeld

Description

On Windows, session visibility in OpenCode Web/Desktop can break even when DB/session data is valid.
The sidebar appears to filter sessions by exact directory string.
Differences in path representation (\ vs /, B: vs b:) cause:

  1. Main workspace sessions not showing
  2. Duplicate worktree entries where one is empty
  3. Global project (worktree /) showing no sessions despite /session API returning rows
    This is reproducible in 1.2.9 and 1.2.10.

Environment

  • OS: Windows 10/11
  • OpenCode: 1.2.9, 1.2.10
  • UI: Web/Desktop
  • Data dir: %USERPROFILE%\\.local\\share\\opencode

Symptoms

  • local: maint for DRE sometimes shows no sessions.
  • feature/loc-turkish appears twice in sidebar:
    • one entry has sessions
    • the other is empty
  • OpenCode-Playground sessions can be returned by /session API but sidebar still empty.

Diagnostics / Evidence

  • DB integrity and JSON sidecars are valid (PRAGMA integrity_check = ok, json.load passes).
  • API returns healthy counts:
    • /session?directory=b:/dev/DRE/dre4 -> hundreds of sessions
  • But alternate equivalent path forms can return 0.
  • DEBUG logs show mixed directory contexts being created for same physical path:
    • directory=C:/.../crisp-planet
    • directory=C:\...\crisp-planet

Expected

Path-equivalent Windows directories should be canonicalized before:

  • project lookup
  • workspace dedupe
  • session filtering
    So equivalent paths should always resolve to same workspace/session list.

Actual

Session visibility and workspace dedupe are based on raw string equality, causing empty lists and duplicate entries.


Suggested fix

Normalize path keys in one place (both read/write):

  • slash normalization
  • drive letter case normalization
  • optional case-insensitive compare on Windows
  • use normalized path for:
    • project.current resolution
    • /session?directory=... filtering
    • workspace deduping
    • sidecar/DB consistency checks

Plugins

Unrelated

OpenCode version

1.2.10

Steps to reproduce

Repro (path sensitivity)

  1. Have sessions stored with directory B:/dev/DRE/dre4 (or b:/...).
  2. Open project via another equivalent path form (B:\dev\DRE\dre4, or case variant).
  3. Observe sidebar session list empty or partial.
  4. Query API:
    • /session?directory=b:/dev/DRE/dre4 returns sessions
    • /session?directory=B:/dev/DRE/dre4 returns 0 (or vice versa)
      Result depends on which canonical form sessions were written with.

Repro (duplicate workspace entry)

  1. Enable workspaces for a repo with a local worktree (e.g. crisp-planet).
  2. Observe same worktree shown twice in sidebar.
  3. One entry resolves to C:/.../crisp-planet, the other to C:\...\crisp-planet.
  4. Sessions exist only under one string variant, so one duplicate workspace is empty.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal but issue only in Web UI (maybe Desktop UI as well)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwebRelates to opencode on web / desktopwindows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions