GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: normalize Windows desktop session paths by Blueteemo · Pull Request #26580 · anomalyco/opencode

Conversation

@Blueteemo

@Blueteemo Blueteemo commented May 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #17765

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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.worktree stored as "/" (Unix-style root)
  • session.directory stored as "C:\" (Windows path format)
  • lastProjectSession key stored as "/"

This path mismatch prevented the Desktop UI from matching/loading existing sessions after restart.

Solution: Added consistent path normalization in two places:

  1. packages/app/src/utils/path-key.ts - Simplified pathKey() to properly handle Windows root paths (e.g., C:\ or /) -> normalize to /
  2. packages/opencode/src/session/session.ts - Added normalizeDirectory() helper to normalize directory paths before storing sessions

How did you verify your code works?

  1. Manually edited the Desktop's opencode.global.dat file to fix path mismatches (changing "/" to "C:\" for worktree and lastProject)
  2. Confirmed sessions reappeared in the sidebar after the path fix
  3. The fix ensures new sessions are created with normalized paths, preventing future mismatches

Screenshots / recordings

N/A - This is a backend fix, not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Blueteemo
fix: normalize Windows desktop session paths
ffaff15
@Blueteemo
Blueteemo requested a review from adamdotdevin as a code owner May 9, 2026 20:35
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 9, 2026
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

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:

  1. PR fix: normalize Windows session directory filters #26463 - "fix: normalize Windows session directory filters"

    • fix: normalize Windows session directory filters #26463
    • Directly related to normalizing Windows session directory paths
  2. PR fix: sessions missing from sidebar on Windows due to path separator mismatch #23862 - "fix: sessions missing from sidebar on Windows due to path separator mismatch"

    • fix: sessions missing from sidebar on Windows due to path separator mismatch #23862
    • Addresses the exact same symptom (sessions missing from sidebar on Windows) due to path separator issues
  3. PR fix: normalize windows path separators in session queries #20215 - "fix: normalize windows path separators in session queries"

    • fix: normalize windows path separators in session queries #20215
    • Focuses on normalizing path separators in session-related queries
  4. PR fix/windows path normalization(#21441) #21852 - "fix/windows path normalization(SortableWorkspace session list empty due to store.path.directory not bootstrapped #21441)"

    • fix/windows path normalization(#21441) #21852
    • Another Windows path normalization fix
  5. PR fix: normalize WSL desktop session paths #22049 - "fix: normalize WSL desktop session paths"

    • fix: normalize WSL desktop session paths #22049
    • Similar issue for WSL paths

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Blueteemo
Merge branch 'dev' into fix/issue-17765-windows-desktop-session-paths
cc19bf9
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 9, 2026
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Blueteemo and others added 3 commits May 10, 2026 04:53
@Blueteemo
Merge branch 'dev' into fix/issue-17765-windows-desktop-session-paths
14879f8
@Brendonovich
formatting
f0723ad
@Brendonovich
Merge branch 'dev' into fix/issue-17765-windows-desktop-session-paths
a952181
This was referenced May 17, 2026
fix(session): normalize session directory filters across path variants #28040
Closed
Fix/windows path separator session list #28165
Closed
fix: normalize forward slashes to backslashes for Windows directory matching #28240
Closed
Fix(opencode): windows path separator session list #28306
Closed
@Blueteemo
Merge branch 'dev' into fix/issue-17765-windows-desktop-session-paths
45e6f52
@Blueteemo Blueteemo closed this by deleting the head repository May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adamdotdevin adamdotdevin Awaiting requested review from adamdotdevin

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Blueteemo @Brendonovich
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.