[PR #10378] fix: handle cross-platform path separators in storage.list() - Issue #10349 #13423

Closed
opened 2026-02-16 18:18:17 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10378

State: closed
Merged: No


Problem

Sessions created on Windows are invisible on Linux/macOS and vice versa due to platform-specific path separators.

Root Cause: The code used path.sep (platform-specific separator) to split paths:

  • Windows: paths split on \
  • Linux/macOS: paths split on /
  • Result: Cross-platform synced sessions cannot find files

Solution

Changed split(path.sep) to split(/[\\\\]/) to handle both separators:

// Split by both separators for cross-platform compatibility
// This handles synced data from Windows (\\) on Unix-like systems (/) and vice versa
const parts = withoutExt.split(/[\\\\]/)

Impact

  • Critical Data Loss Bug: Users working across platforms lost access to their sessions
  • Sync Issues: Repositories shared between Windows and Unix-like systems had broken session visibility

Testing

  • Verified with existing test suite (752/759 tests passing)
  • Manually tested session creation on Linux and verified paths work with Windows-style separators

Fixes #10349 - Critical cross-platform compatibility bug

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10378 **State:** closed **Merged:** No --- ## Problem Sessions created on Windows are invisible on Linux/macOS and vice versa due to platform-specific path separators. **Root Cause**: The code used `path.sep` (platform-specific separator) to split paths: - Windows: paths split on ``\`` - Linux/macOS: paths split on `/` - Result: Cross-platform synced sessions cannot find files ## Solution Changed `split(path.sep)` to `split(/[\\\\]/)` to handle both separators: ```typescript // Split by both separators for cross-platform compatibility // This handles synced data from Windows (\\) on Unix-like systems (/) and vice versa const parts = withoutExt.split(/[\\\\]/) ``` ## Impact - **Critical Data Loss Bug**: Users working across platforms lost access to their sessions - **Sync Issues**: Repositories shared between Windows and Unix-like systems had broken session visibility ## Testing - Verified with existing test suite (752/759 tests passing) - Manually tested session creation on Linux and verified paths work with Windows-style separators Fixes #10349 - Critical cross-platform compatibility bug
yindo added the pull-request label 2026-02-16 18:18:17 -05:00
yindo closed this issue 2026-02-16 18:18:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13423