Uh oh!
There was an error while loading. Please reload this page.
fix: keep sessions discoverable for non-git projects on Windows - #40503
Open
BB-84C wants to merge 1 commit into
Open
fix: keep sessions discoverable for non-git projects on Windows#40503BB-84C wants to merge 1 commit into
BB-84C wants to merge 1 commit into
Conversation
Non-git projects use worktree "/", and on Windows path.resolve("/")
resolves to the drive root of the current process. sessionPath() therefore
stored a machine-dependent absolute path (e.g. "D:/repo") that the session
list query's worktree-relative match can never find, hiding those sessions
from the picker.
- sessionPath(): return undefined when the worktree-relative result is
absolute (cross-volume / non-git Windows), so sessions fall back to the
existing directory-based scoping in the list query.
- TUI session list: pass directory alongside path so the server can match
pathless rows.
- Migration: NULL out legacy absolute/empty paths so existing sessions
become visible again.Contributor
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes#35750
Type of change
What does this PR do?
Sessions created in non-git projects on Windows can disappear from the session picker.
Non-git projects use worktree
"/"(set inProject.fromDirectory). On Windows,path.resolve("/")resolves to the drive root of the current process, sosessionPath()produced a machine-dependent absolute path likeD:/repoand stored it insession.path. The session list query matches paths relative to the worktree, so those rows never matched and the sessions vanished from the picker. Which sessions were visible depended on which drive root the server process happened to be rooted at. Related reports: #37041, #37353, #38780.Changes:
sessionPath()returnsundefinedwhen the worktree-relative result is absolute (cross-volume, which is what happens for non-git worktrees on Windows). Sessions without a usable path fall back to the existing directory-based scoping inlistByProject(path IS NULL AND directory = ?).directoryalongsidepath, which is what makes the directory fallback reachable for project instances. POSIX behavior and git-project behavior are unchanged (the path condition still matches first).20260804120000_normalize_session_pathNULLs out legacy absolute/empty paths so existing sessions become visible again after upgrade.How did you verify your code works?
sessionPath(win32 cross-volume returns undefined, same-volume keeps relative, posix unchanged) inpackages/opencode/test/session/session-path.test.ts.packages/opencode/test/server/session-list.test.ts: a NULL-path session is listed whendirectoryis provided and stays hidden without it. 12/12 pass in that file.tsgo --noEmitpasses foropencode,tui, andcore; oxlint clean on changed files.D:\BB84.ai): built the fork binary, pointed it at a snapshot copy of a real production DB (16,873 sessions, including rows with stored absolute paths likeD:/BB84.aiand empty paths), enabled session directory filtering in the TUI, and confirmed sessions remain visible instead of being lost. The migration was exercised on the snapshot only; the production DB was not modified.Screenshots / recordings
No screenshots - verification was done interactively in the TUI.
Checklist