fix: normalize Windows desktop session paths#26580
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found several related PRs that address similar path normalization issues on Windows:
These PRs suggest there's been an ongoing issue with path normalization across different environments. PR #23862 appears most closely related as it addresses the same symptom of sessions disappearing from the sidebar on Windows due to path mismatches. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #17765
Type of change
What does this PR do?
On Windows Desktop, all session history disappears every time the client is closed and reopened. The sessions still exist in the SQLite database but the UI shows an empty list.
Root cause: Path normalization was inconsistent across different parts of the system:
project.worktreestored as"/"(Unix-style root)session.directorystored as"C:\"(Windows path format)lastProjectSessionkey stored as"/"This path mismatch prevented the Desktop UI from matching/loading existing sessions after restart.
Solution: Added consistent path normalization in two places:
packages/app/src/utils/path-key.ts- SimplifiedpathKey()to properly handle Windows root paths (e.g.,C:\or/) -> normalize to/packages/opencode/src/session/session.ts- AddednormalizeDirectory()helper to normalize directory paths before storing sessionsHow did you verify your code works?
opencode.global.datfile to fix path mismatches (changing"/"to"C:\"for worktree and lastProject)Screenshots / recordings
N/A - This is a backend fix, not a UI change.
Checklist