Skip to content

fix(session): normalize Windows directory paths in session list#30367

Open
XJPeng12 wants to merge 1 commit into
anomalyco:devfrom
XJPeng12:fix/win32-session-list-directory
Open

fix(session): normalize Windows directory paths in session list#30367
XJPeng12 wants to merge 1 commit into
anomalyco:devfrom
XJPeng12:fix/win32-session-list-directory

Conversation

@XJPeng12
Copy link
Copy Markdown

@XJPeng12 XJPeng12 commented Jun 2, 2026

Issue for this PR

Closes #30374

Type of change

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

What does this PR do?

On Windows, sessions are stored with backslash paths while the web app and HTTP API query with forward slashes. Session list filters used exact string equality, so E:/foo and E:\foo did not match the same SQLite rows and the sidebar session list looked empty.

Adds normalizeListDirectory() using path.win32.normalize() on Windows only, applied in listByProject, in-service Session.listGlobal, and exported listGlobal.

How did you verify your code works?

Added/updated tests in packages/opencode/test/server/session-list.test.ts. Verified that forward-slash and backslash forms of the same Windows directory return the same session rows.

Screenshots / recordings

N/A — backend path normalization fix.

Checklist

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

On Windows, sessions are stored with backslash paths while HTTP and the
web app query with forward slashes. Normalize list filters so E:/foo and
E:\foo match the same rows and the sidebar session list is not empty.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

Based on the search results, there are several related PRs addressing similar Windows directory path issues in session lists:

  1. fix(session): normalize session directory filters across path variants #28040 - fix(session): normalize session directory filters across path variants

    • Directly related to normalizing path variants
  2. fix(session): match Windows directory separators #28027 - fix(session): match Windows directory separators

    • Addresses Windows directory separator matching
  3. Fix(opencode): windows path separator session list #28306 - Fix(opencode): windows path separator session list

    • Focuses on Windows path separators in session list
  4. fix: normalize forward slashes to backslashes for Windows directory matching #28251 - fix: normalize forward slashes to backslashes for Windows directory matching

    • Converts forward slashes to backslashes for Windows matching
  5. fix: normalize Windows session directory filters #26463 - fix: normalize Windows session directory filters

    • Earlier attempt at normalizing session directory filters
  6. fix(windows): support mapped network drive paths #26649 - fix(windows): support mapped network drive paths

    • Related Windows path handling

These PRs all appear to address the same core issue: normalizing Windows directory paths in session lists to handle the mismatch between backslash and forward slash path separators. You should check whether these PRs were previously closed/merged and if there's any overlap with the current PR #30367.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

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

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.

fix(session): Windows session list empty when directory uses forward slashes

1 participant