Repository navigation
fix: keep sessions on worktrees outside .tempest across restarts - #153
Conversation
|
@orshih6 is attempting to deploy a commit to the Tempest OSS Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for picking this up so quickly! I reported #151, and this looks like the right fix: external worktrees whose folder still exists now survive the prune, come back in the sidebar, and get their sessions reopened. Three small things, none blocking:
Would you like to handle these, or would you prefer I open a follow-up PR? |
|
Thanks @lvanhouten, all three are good flags.
We are working on these as follow-ups. Merging this into main now since it fixes the common case and the three items are additive on top. |
…l by branch name Follow-up to #153 addressing lvanhouten's three review flags: 1. New `path_exists` command (uses `Path::try_exists`) replaces the `list_directory` probe. Err only on genuine I/O faults. 2. Transient probe failures now keep the branch instead of pruning its sessions — the whole point of #151 was to not delete sessions whose folders still exist. 3. External worktrees opened via the picker pre-mint their branch row with the live display name, so the sidebar label survives a restart instead of collapsing to the folder basename. Co-authored-by: Tempest <tempestai.dev@gmail.com>
The boot restore in WorkspaceView found worktrees only by listing
<project>/.tempest. A branch opened directly into an existing worktree elsewhere on disk (theexistingBranch.is_worktreepath in the picker) was saved to SQLite with that outside path. That meant it was never added back toproject.worktrees, and every session on it failed the prune check.pruneSessionsthen deleted those sessions from the DB, even though the folder still existed.Changes:
src/components/worktreeRestore.ts:externalBranchCandidatespicks the saved branches of open projects that the.tempestscan didn't find.anchoredSessionIdsis the existing keep-or-prune decision, moved out of the component unchanged except that it takes the set of live worktree paths.list_directorycommand. Branches whose folder exists are added to the live set used by the prune and are appended toproject.worktrees, so the sidebar row and its sessions come back. Branches whose folder is gone are still pruned, the same as before (no change to the [Bug]: Left sidebar resurrects stale/deleted sessions #129 behaviour).getAllBranches()added to the sessions store to expose the saved branch rows.Testing:
src/components/worktreeRestore.check.ts, which covers an external worktree that still exists (its session is kept), one whose folder is gone (pruned), an unknown branch id, and root sessions of open and closed projects.npm test worktreeRestorepasses.npx tsc --noEmitreports no errors in the touched files. I installed only the root package, so the existing errors from the@tempest/*workspace packages that weren't built are unrelated.git worktree add ../wt/x x, open a session onx, then relaunch.🤖 Generated with Claude Code
Fixes #151
This change was prepared with an AI coding agent (Claude) and reviewed by me before submitting. I'm happy to make any changes you'd like.