Conversation
Non-git projects synthesize a worktree of "/" (project.ts). On Windows
path.resolve("/") anchors to the launch drive root, so the same directory
could store sessions under different relative paths ("Users/..." vs
"Dev/...") depending on which drive opencode was started from, which
made session.path unstable and hid sessions from path-based filters.
- sessionPath(): anchor a synthetic "/" worktree to the directory own
drive root so stored paths are deterministic (no-op on POSIX where the
root is always "/"); also reused by cli import to avoid drift.
- tests: unit coverage for sessionPath and server coverage for
project-wide (scope project) listing of non-git sessions.
|
The following comment was made by an LLM, it may be inaccurate: Found a related PR that may be addressing similar Windows session path issues: Related PR:
The current PR (#41568) appears to be a more targeted fix that ensures stored session paths are deterministic across different drive launches on Windows, while #40503 may have addressed an earlier aspect of the same problem. You may want to check if #40503 is still open/merged and whether it fully resolves the underlying issue or if this PR provides a complementary fix. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #41567
Type of change
What does this PR do?
On Windows, non-git projects get a synthetic worktree of
"/"(project.ts).path.relative(path.resolve("/"), cwd)then anchors the relative path to the drive root of the process working directory, so the same directory stores differentsession.pathvalues depending on which drive opencode was launched from (Users/...vsDev/..., or absolute-styleC:/Users/...when crossing drives). Path-based directory filtering in/sessionsthen hides sessions depending on the launch drive.The fix anchors a synthetic
"/"worktree to the directory's own drive root (path.parse(dir).root) when computingsessionPath(), making stored paths deterministic and independent of the launch drive. On POSIX the root is always"/"so behavior is unchanged.cli/import.tshad a second copy of the same path logic and now reusessessionPath()to avoid drift.Note: same-directory visibility from
/sessionsis scoped by directory in #38532; this PR makes the underlying stored paths stable on Windows.How did you verify your code works?
sessionPath()covering the git worktree, non-git"/"worktree, and cross-drive absolute results.scope: "project") listing and for listing non-git sessions stored relative to the directory root.bun run typecheckinpackages/opencodeand the TUI tests.C:remain listed under a path anchored toC:, and no longer produce drive-dependent relative paths.Screenshots / recordings
N/A (not a UI change)
Checklist