Sessions not visible across platforms when syncing data directory (cross-platform session visibility) #7417

Open
opened 2026-02-16 18:07:06 -05:00 by yindo · 1 comment
Owner

Originally created by @ErcinDedeoglu on GitHub (Jan 24, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When using Syncthing (or similar tools) to sync the OpenCode data directory (~/.local/share/opencode) across multiple platforms (Windows, macOS, Linux), sessions created on one platform are not visible on other platforms.

Root Cause

Sessions are filtered by the directory field in packages/opencode/src/server/routes/session.ts:

if (query.directory !== undefined && session.directory !== query.directory) continue

Sessions store the absolute path where they were created:

  • Windows: C:\git\github\ercin\wow-dump
  • macOS: /Users/ercin/projects/wow-dump
  • Linux: /home/ubuntu/wow-dump

Since these paths don't match across platforms, sessions created on one platform are filtered out on others.

Steps to Reproduce

  1. Set up Syncthing to sync ~/.local/share/opencode between Windows and macOS/Linux
  2. Create a session on Windows in directory C:\git\github\project
  3. Open OpenCode on macOS/Linux in the equivalent directory /Users/username/git/github/project
  4. The Windows session is not visible in the session list

Expected Behavior

Sessions should be visible across platforms when syncing the data directory, especially for:

  • Global sessions (not tied to a specific project)
  • Sessions where the user explicitly wants cross-platform visibility

Proposed Solution

Add a configuration option like showAllSessions: true in opencode.json that bypasses the directory filtering:

const config = await Config.get()
if (!config.showAllSessions && query.directory !== undefined && session.directory !== query.directory) continue

Alternatively:

  1. Normalize paths - Store relative paths or use a project identifier instead of absolute paths
  2. Path mapping - Allow users to define path equivalences in config (e.g., C:\git/Users/x/git)
  3. Show all global sessions - At minimum, make sessions in the global/ folder visible everywhere

Environment

  • OpenCode version: 1.1.34
  • Platforms: Windows 11, macOS, Ubuntu Linux
  • Sync tool: Syncthing 2.0.13

Related Issues

  • #631 (Windows Support)
  • #4686 (TUI sends absolute local paths)
Originally created by @ErcinDedeoglu on GitHub (Jan 24, 2026). Originally assigned to: @thdxr on GitHub. ### Description When using Syncthing (or similar tools) to sync the OpenCode data directory (`~/.local/share/opencode`) across multiple platforms (Windows, macOS, Linux), sessions created on one platform are not visible on other platforms. ### Root Cause Sessions are filtered by the `directory` field in `packages/opencode/src/server/routes/session.ts`: ```typescript if (query.directory !== undefined && session.directory !== query.directory) continue ``` Sessions store the absolute path where they were created: - Windows: `C:\git\github\ercin\wow-dump` - macOS: `/Users/ercin/projects/wow-dump` - Linux: `/home/ubuntu/wow-dump` Since these paths don't match across platforms, sessions created on one platform are filtered out on others. ### Steps to Reproduce 1. Set up Syncthing to sync `~/.local/share/opencode` between Windows and macOS/Linux 2. Create a session on Windows in directory `C:\git\github\project` 3. Open OpenCode on macOS/Linux in the equivalent directory `/Users/username/git/github/project` 4. The Windows session is not visible in the session list ### Expected Behavior Sessions should be visible across platforms when syncing the data directory, especially for: - Global sessions (not tied to a specific project) - Sessions where the user explicitly wants cross-platform visibility ### Proposed Solution Add a configuration option like `showAllSessions: true` in `opencode.json` that bypasses the directory filtering: ```typescript const config = await Config.get() if (!config.showAllSessions && query.directory !== undefined && session.directory !== query.directory) continue ``` Alternatively: 1. **Normalize paths** - Store relative paths or use a project identifier instead of absolute paths 2. **Path mapping** - Allow users to define path equivalences in config (e.g., `C:\git` ↔ `/Users/x/git`) 3. **Show all global sessions** - At minimum, make sessions in the `global/` folder visible everywhere ### Environment - OpenCode version: 1.1.34 - Platforms: Windows 11, macOS, Ubuntu Linux - Sync tool: Syncthing 2.0.13 ### Related Issues - #631 (Windows Support) - #4686 (TUI sends absolute local paths)
yindo added the windows label 2026-02-16 18:07:06 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 24, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #8836: session list is showing all sessions not only the ones scopes to the current dir
  • #6098: The sessions list seems to show all history, not the sessions history of the working directory
  • #3551: Sessions are now mixed with home directory session list, disregarding which directory you're in
  • #6460: New WSL session uses wrong path, causing early read/shell failures
  • #4686: TUI sends absolute local paths causing ENOENT on server side
  • #6697: [BUG]: Session switching doesn't change working directory context

These issues relate to the same root cause: sessions store absolute paths that are platform-specific, causing filtering and visibility issues across different contexts. Your cross-platform syncing scenario is a specific manifestation of this broader directory path handling problem.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 24, 2026): This issue might be a duplicate of existing issues. Please check: - #8836: session list is showing all sessions not only the ones scopes to the current dir - #6098: The sessions list seems to show all history, not the sessions history of the working directory - #3551: Sessions are now mixed with home directory session list, disregarding which directory you're in - #6460: New WSL session uses wrong path, causing early read/shell failures - #4686: TUI sends absolute local paths causing ENOENT on server side - #6697: [BUG]: Session switching doesn't change working directory context These issues relate to the same root cause: sessions store absolute paths that are platform-specific, causing filtering and visibility issues across different contexts. Your cross-platform syncing scenario is a specific manifestation of this broader directory path handling problem. Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7417