Skip to content

BUG - migrateFromGlobal skips sessions after directory case change on Windows #17518

@NamedIdentity

Description

@NamedIdentity

Describe the bug

The inline global session migration in fromDirectory (project.ts) uses eq(SessionTable.directory, data.worktree) — SQLite strict equality. On Windows where paths are case-insensitive, sessions stored under a directory with different casing are silently skipped during migration.
For example: sessions created in C:\ai-work\dtd\my-project (lowercase parent) are never migrated when the parent is later renamed to C:\ai-work\DTD\my-project (uppercase). The WHERE directory = 'C:\ai-work\DTD\my-project' never matches the stored lowercase path.
Related to #17183 (broader Windows path normalization).

Steps to reproduce

  1. Open opencode in a non-git directory (e.g. C:\work\dtd\project) — sessions created under global
  2. Rename parent directory casing (e.g. dtdDTD)
  3. Run git init + first commit in the project
  4. Restart opencode — migration runs but skips the old sessions because dtdDTD
  5. Old sessions remain orphaned under global

OpenCode version

1.2.24+

Operating System

Windows 10

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

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