feat(v2): manage session families across worktrees - #649
Conversation
Use the shared OpenCode V2 service to inventory complete project session families and move them through the native session.move API. Serialize project operations, verify authoritative locations, and roll back only transaction-owned moves when failures occur. Make worktree deletion transactional by evacuating inactive session families before Git removal. Strict NUL-delimited inventory checks, HEAD revalidation, physical-root workspace reservations, nested workspace projection, and cache invalidation prevent stale or in-use worktrees from being removed. Cover cursor pagination, family resolution, rollback, deletion evacuation, nested logical roots, exact Git slug resolution, and workspace creation races. Validated with server typecheck and the full 237-test server suite.
Treat SessionInfo.location as the authoritative worktree assignment, load every project-scoped cursor page, and project complete session families for search, filtering, and activity/name/worktree sorting. Family moves now run through the server transaction and refresh from OpenCode instead of mutating local paths optimistically. Show localized root and linked-worktree badges, preserve complete ancestry during filters, refresh worktrees and sessions after deletion, and apply the complete authoritative session.moved payload. Expose the desktop file-manager action only for local paths with keyboard support. Add coverage for project query construction, path normalization, family projection, native move events, request authority, serialized family moves, and deletion refresh; register the new runnable tests in CI. Validated with UI typecheck, 35 affected CI-mode tests, and production builds.
Add desktop-only Electron and Tauri commands for revealing local worktree directories. Reuse the existing renderer token, origin, frame, and generation authority instead of introducing a separate bridge. Reject relative, control, network, device, and non-directory targets before opening. Canonicalize inputs, require exact NUL-delimited Git inventory membership, constrain logical subdirectories beneath registered worktrees, and repeat authorization and inventory checks to narrow races. Keep Electron and Tauri behavior aligned with targeted parser, validation, authorization, containment, and revalidation tests. Validated with Electron typecheck and 124/124 native tests plus cargo check and 87/87 Rust tests.
Integrate the current native V2 routing, workspace controls, shared desktop opener, lifecycle hardening, and pruned validation matrix while removing the PR's duplicate Electron and Tauri file-manager bridges. Inventory sessions through paginated native project filtering, move complete families transactionally, revalidate worktree path and HEAD immediately before deletion, and fail closed if a checkout is replaced. Preserve evacuated sessions at the safe root rather than rolling them into a replacement checkout. Reduce feature tests to project pagination, family moves, rollback, active-session blocking, replacement races, route ownership, UI projection, and authoritative refresh. Server, UI, Electron, and Rust checks plus focused suites and diff checks pass; the full server matrix had one transient process timeout that passed alone.
Merge upstream DEV-v2 while retaining server-owned transactional worktree evacuation. The UI issues one deletion request and refreshes authoritative worktree and session state, avoiding partial client-cache-driven family moves; server deletion remains blocked whenever complete-family evacuation fails and rolls back transaction-owned moves. Preserve the upstream native createData and cursor pagination contracts and the removal of forceNew canonical duplication. Validated with server and UI typechecks, focused server worktree transaction tests, focused UI browser integration and pagination tests, and git diff checks.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32199550180 Artifacts expire in 7 days.
|
1 similar comment
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32199550180 Artifacts expire in 7 days.
|
…60818 # Conflicts: # packages/server/src/server/routes/worktrees.test.ts # packages/server/src/server/routes/worktrees.ts
…60818 # Conflicts: # packages/server/src/server/routes/worktrees.ts # packages/server/src/workspaces/worktree-session-evacuation.test.ts # packages/server/src/workspaces/worktree-session-evacuation.ts
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32202206795 Artifacts expire in 7 days.
|
1 similar comment
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32202206795 Artifacts expire in 7 days.
|
# Conflicts: # packages/server/src/workspaces/worktree-session-evacuation.ts
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32215068777 Artifacts expire in 7 days.
|
1 similar comment
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32215068777 Artifacts expire in 7 days.
|
Translate host worktree paths into the OpenCode service namespace before project resolution, moves, and evacuation while retaining host paths for Git deletion and reservations. Publish serviceDirectory so WSL session grouping and filtering compare native locations correctly. Reject malformed cursors, poll boundedly for move and rollback visibility, and recheck activity before each move and Git removal. Add malformed-cursor, delayed-visibility, concurrent-activation, and route regressions; validate server/UI/Electron typechecks, 18 focused tests, and diff cleanliness.
Resolve OpenCode targets from mirrored nested workspace paths while preserving physical roots for Git operations. Determine rollback ownership from per-session state and compare POSIX service paths with case-sensitive semantics on Windows hosts. Add nested-route, stale-inventory rollback, and WSL case-sensitivity regressions; validate server typecheck, 20 focused tests, and diff cleanliness.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32226249423 Artifacts expire in 7 days.
|
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/32262724562 Artifacts expire in 7 days.
|
Merge the latest DEV-v2 baseline and replace directory-local worktree session handling with complete native OpenCode V2 project inventories. Session families now move transactionally with opaque cursor pagination, active-session checks, authoritative verification, rollback, workspace scoping, and post-mutation refreshes. Protect physical worktree deletion with workspace reservations, project-level serialization, canonical path identities, and deletion fences covering every family source and destination. Revalidate Git identity before removal, block sessions owned by other workspaces or projects, and handle nested workspace roots without deleting sibling project sessions. Keep the UI server-authoritative after moves and deletions, reconcile complete session.moved locations, exhaust pagination for global sorting and search, retry failed refreshes, and localize the added worktree controls. Add focused server and UI coverage for races, replacement checkouts, cursor loops, WSL paths, and nested worktrees. Validated with server, UI, Electron, desktop packaging tests, workspace typechecks, and a release Tauri/NSIS build.
Move copy, open, and delete controls out of Kobalte Select.Item options into a toolbar for the selected worktree. This removes nested interactive controls and custom event suppression while preserving mouse and keyboard activation. Validated with the UI typecheck and production UI build.
Integrate the latest DEV-v2 architecture-guide discovery update while preserving the finalized native OpenCode V2 worktree session transactions and accessible selector controls.\n\nThe upstream change is documentation-only and introduces no runtime conflict. This merge keeps PR NeuralNomadsAI#649 current without rewriting its reviewed history.
Make worktree deletion fail closed across complete native session families, shared Shell and PTY locations, concurrent workspace ownership, and final Git identity checks. Preserve rollback safety and WSL path semantics while keeping the OpenCode V2 service lifecycle native. Make the selector actions explicit and accessible with localized labels, and resynchronize worktrees and moved-session catalogs after reconnects and foreground recovery. Exhaust every session page for global sorting while fencing superseded pagination and keeping SDK metadata separate from local runtime state. Cover mixed-workspace families, late blockers, Git replacement races, WSL case sensitivity, multi-page sorting, superseded refreshes, and native metadata separation. Validated server, UI, Electron, and Rust suites plus typechecks, builds, lock integrity, and desktop resource closure.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/33347402492 Artifacts expire in 7 days.
|
Replace the obsolete fixed WebView2 profile and CDP port instructions with the persistent Developer Mode toggle and authenticated restart bridge introduced on DEV-v2. Document that desktop relaunches preserve the shared OpenCode daemon, while Windows Tauri still permits a manual stop and relaunch only when the linker cannot replace the running executable. Validated with complete server, UI, Electron native, and Rust test suites; server and Electron production builds; all workspace typechecks; dependency dry-run; and desktop resource integrity tests.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/33376915849 Artifacts expire in 7 days.
|
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/33379837386 Artifacts expire in 7 days.
|
Summary
SessionInfo.locationwith complete pagination, worktree badges, sorting, filtering, and localized labelsThis supersedes #642 with a native V2 implementation. #642 is intentionally left open and unchanged.
Updated V2 Contract
Merged
DEV-v2@bce40b7f; PR HEAD isab9f5d8c(1,889+/606-, 52 files).session.movedconsumes the complete authoritative location/project payload and avoids speculative cross-workspace transfersworkspaceIDauthority0.0.0-beta-18414; the independently updated CLI is validated through service/API compatibility rather than an exact version gateDeletion Safety
WorktreeDeletionFencecover every source/destination worktree used by a family mutationUI Behavior
Select.ItemValidation
377passed,2platform skips304passed148passed180passed3passed18and45passedbuild:tauri/NSIS packagegit diff --checkand conflict-marker scanResidual Limit
OpenCode V2 and Git do not expose a shared snapshot/CAS transaction to external clients. CodeNomad fails closed and narrows races with reservations, project locks, deletion fences, and repeated authoritative checks; an unrelated process operating outside CodeNomad can still mutate Git or OpenCode state beyond those admission controls.