Skip to content

fix(app): bypass path normalization to fix sidebar session queries on…#1164

Open
shanliuling wants to merge 2 commits intodifferent-ai:devfrom
shanliuling:fix/860-windows-session-persistence
Open

fix(app): bypass path normalization to fix sidebar session queries on…#1164
shanliuling wants to merge 2 commits intodifferent-ai:devfrom
shanliuling:fix/860-windows-session-persistence

Conversation

@shanliuling
Copy link
Copy Markdown

Fixes: #860

What

Bypass aggressive path normalization for the directory query when fetching sidebar workspace sessions from the OpenCode server on Windows.

Why

Currently on Windows, the normalizeDirectoryQueryPath function converts raw Windows paths (e.g., D:\Projects\MyWork) into forward-slashed lowercase paths (e.g., d/projects/mywork). However, the OpenCode server's underlying SQLite database stores the raw paths. This mismatch causes the server-side directory filter to fail, resulting in an empty session history list in the sidebar on app restart.

How

  • Removed normalizeDirectoryQueryPath from the queryDirectory assignment in refreshSidebarWorkspaceSessions (located in app.tsx).
  • By passing the raw directory string directly to the server, the query correctly matches the stored SQLite payload.
  • Client-side filtering logic (filtered = root ? list.filter(...) : list) remains unchanged, safely using normalizeDirectoryPath on both sides to ensure exact matching after the data is received.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Apr 9, 2026 6:57am

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 25, 2026

@shanliuling is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

@lrq3000
Copy link
Copy Markdown

lrq3000 commented Mar 30, 2026

Please merge this PR, OpenWork is unusable on Windows without this fix (bug still happening on v0.11.196).

@shanliuling
Copy link
Copy Markdown
Author

shanliuling commented Mar 31, 2026

Please merge this PR, OpenWork is unusable on Windows without this fix (bug still happening on v0.11.196)

Thanks for the support!
If you are building from source and need this fix immediately, you can manually apply the changes:

  1. Open the file: apps/app/src/app/context/sidebar-sessions.ts
  2. Find line 142: const queryDirectory = normalizeDirectoryQueryPath(directory) || undefined;
  3. Change it to: const queryDirectory = directory || undefined;
    This will bypass the path normalization that causes the query mismatch on Windows. Hope this helps while we wait for the

@lrq3000
Copy link
Copy Markdown

lrq3000 commented Apr 3, 2026

Please devs merge this, currently Windows users cannot use this app at all due to this bug, that's a big part of computer users.

I tried to build but it is a nightmare to build and run on Windows.

@shanliuling
Copy link
Copy Markdown
Author

Has the latest version fixed it? If it has, I will close this PR.

@lrq3000
Copy link
Copy Markdown

lrq3000 commented Apr 9, 2026

@shanliuling Unfortunately I cannot test anymore since the access to the Windows build was made to be paid.

Given how the app is freely accessible for other platforms and how unreliable it is on Windows, I don't think that was a good idea at all and is quite discriminative, but maybe the idea was to reduce the devs workload more than really making a commercial offering?

@OmarMcAdam
Copy link
Copy Markdown
Collaborator

Trying to borrow a laptop to test this on

@OmarMcAdam OmarMcAdam self-requested a review April 9, 2026 21:36
@OmarMcAdam
Copy link
Copy Markdown
Collaborator

OmarMcAdam commented Apr 9, 2026

Thanks for digging into this. I did a deeper pass on the bug and the proposed fix is pointing at the right root cause: Windows session history breaks when the sidebar query path no longer matches the exact directory string stored by the server/SQLite layer. That said, this PR appears to be superseded by #1256, which is already merged into dev and updates the same code path in apps/app/src/app/context/sidebar-sessions.ts to use toSessionTransportDirectory(directory) instead of the local-only query normalizer. That landed as commit 13f909a1 and is a slightly safer version of the same fix because it preserves the transport format expected by the server while still handling Windows-specific path variants.

So my current read is:

Unless we find a remaining repro on current dev, I think this PR should be closed as superseded by #1256.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants