Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds stable, canonical worktree identities and host-qualified metadata persistence. Metadata reads, writes, migrations, aliases, cleanup, and discovery now distinguish execution hosts. IPC and preload APIs accept host identifiers. Runtime selectors support Merge Risk: 🟡 Moderate · up to This PR makes worktree metadata and mutations host-specific, but several collision edge cases remain: legacy repair can remove another host’s metadata, fallback lifecycle paths can use the wrong host’s state, and reassignment can orphan records when instance identity is missing. Bulk updates, renames, and ordering also retain bounded consistency risks, so merge should wait for fixes or explicit owner acceptance. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.97% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 62 functions across 59 files. (1 skipped: 1 too large.) Full details: Description checkExplanation The description is complete and directly explains the identity-collision problem, implementation, compatibility behavior, testing, review status, scope boundaries, and checklist results. It links issue
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.ts (1)
87-102: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftKeep host identity in bulk metadata updates.
updatesByWorktreeIdcollapses colliding locators, then Lines 90-102 persist the same update to every owner host. Pinning or moving one worktree can change its colliding sibling. Key batch updates by canonical identity or by{ worktreeId, executionHostId }, and persist only the selected owner. As per coding guidelines, “the execution host owns everything that touches execution.”Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 805b3155-f859-4d52-919c-7729fcffde54
📥 Commits
Reviewing files that changed from the base of the PR and between 96565fe and 66fc1dfec0f2fd5258c2fb81506f042a21c56540.
📒 Files selected for processing (39)
src/cli/help.tssrc/cli/index.test.tssrc/cli/selectors.tssrc/main/ipc/worktree-metadata-merge.test.tssrc/main/ipc/worktree-metadata-merge.tssrc/main/ipc/worktrees-create-metadata-persistence.test.tssrc/main/ipc/worktrees-test-harness.tssrc/main/ipc/worktrees-test-ipc-surface.tssrc/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.tssrc/main/persistence-repo-lifecycle.test.tssrc/main/persistence/loading-store/metadata-lineage-operations.tssrc/main/persistence/loading-store/worktree-identity-metadata.tssrc/main/persistence/tracking-repos/repo-worktree-pruning.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.test.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/worktree-scan-admin-fingerprint-gate.test.tssrc/main/worktree-identity-persistence.test.tssrc/preload/api/worktree-api.tssrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsxsrc/renderer/src/components/sidebar/WorktreeMetaDialog.test.tsxsrc/renderer/src/components/sidebar/WorktreeMetaDialog.tsxsrc/renderer/src/components/sidebar/use-workspace-kanban-status-actions.tssrc/renderer/src/components/sidebar/use-workspace-kanban-worktree-actions.tssrc/renderer/src/components/sidebar/use-worktree-card-activation-actions.tssrc/renderer/src/components/sidebar/use-worktree-card-foundation.tssrc/renderer/src/components/sidebar/use-worktree-card-secondary-details.tssrc/renderer/src/components/sidebar/use-worktree-context-menu-commands.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktrees-linked-review-push-target.test.tssrc/renderer/src/store/slices/worktrees-metadata-persistence.test.tssrc/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.tssrc/shared/persisted-state-types.tssrc/shared/worktree/identity.test.tssrc/shared/worktree/identity.tssrc/shared/worktree/types.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
There was a problem hiding this comment.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: aaa7d8bf-36c0-4b88-a89f-186a668f55ad
📥 Commits
Reviewing files that changed from the base of the PR and between 66fc1dfec0f2fd5258c2fb81506f042a21c56540 and c68c037178875deebb775216c5d2b8f842c6df3f.
📒 Files selected for processing (35)
src/cli/help.tssrc/cli/index.test.tssrc/main/ipc/workspace-cleanup-scan.tssrc/main/ipc/worktrees-test-harness.tssrc/main/ipc/worktrees-test-ipc-surface.tssrc/main/ipc/worktrees/listing/ssh-worktree-fallback.tssrc/main/ipc/worktrees/listing/worktree-discovery-metadata.tssrc/main/persistence/host-qualified-worktree-meta.tssrc/main/persistence/loading-store/metadata-lineage-operations.tssrc/main/persistence/loading-store/worktree-identity-metadata.tssrc/main/persistence/tracking-repos/repo-worktree-pruning.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.test.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/repo-worktree-row-resolution.tssrc/main/workspace-space-repo-scan.tssrc/main/worktree-identity-persistence.test.tssrc/renderer/src/components/sidebar/WorkspaceKanbanDrawer.search.test.tsxsrc/renderer/src/components/sidebar/use-workspace-kanban-worktree-actions.tssrc/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.test.tssrc/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.tssrc/renderer/src/components/sidebar/worktree-list/drag/use-status-mutations.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktree-meta-update-application.tssrc/renderer/src/store/slices/worktrees-metadata-persistence.test.tssrc/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.tssrc/renderer/src/store/slices/worktrees/listing/worktree-meta-host-match.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.tssrc/renderer/src/store/slices/worktrees/session/worktree-pin-reveal.tssrc/shared/execution-host.test.tssrc/shared/execution-host.tssrc/shared/project-host-setup-projection.test.tssrc/shared/project-host-setup-projection.tssrc/shared/worktree/identity.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/cli/help.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/main/persistence/loading-store/metadata-lineage-operations.ts (1)
247-258: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPreserve host-scoped state during rename.
When a caller supplies an
executionHostIdthat differs frompersistedOwner, this method skipsmigrateWorktreeIdentityOperation.migrateWorktreeMetadataLocatoronly re-keys identity aliases, so existing tabs and lineage can remain underoldWorktreeId. Migrate the affected host partition and add a regression test.src/renderer/src/components/sidebar/use-workspace-kanban-worktree-actions.ts (1)
99-142: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve all entries from
order.updatesin the batch.buildManualOrderUpdatesForGroupDropreturns ranks for neighboring worktrees as well as dragged worktrees. This callback creates entries only fordrop.worktreeIds, so itsfindsilently drops neighboring rank updates beforeupdateWorktreesMeta. Add each returned worktree with itsexecutionHostId.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 524211ff-7aa0-43ca-80b1-eb86bd5576c6
📥 Commits
Reviewing files that changed from the base of the PR and between c68c037178875deebb775216c5d2b8f842c6df3f and c03b2467261b94a712cfb5204d1a7debb1d23ca9.
📒 Files selected for processing (20)
src/main/ipc/worktrees/listing/ssh-worktree-fallback.tssrc/main/ipc/worktrees/listing/worktree-discovery-metadata.tssrc/main/persistence/loading-store/metadata-lineage-operations.tssrc/main/runtime/repo-worktree-row-resolution.test.tssrc/main/runtime/repo-worktree-row-resolution.tssrc/main/workspace-space-repo-scan.tssrc/main/worktree-identity-persistence.test.tssrc/main/worktree-metadata-ownership.test.tssrc/renderer/src/components/sidebar/use-workspace-kanban-status-actions.tssrc/renderer/src/components/sidebar/use-workspace-kanban-worktree-actions.tssrc/renderer/src/components/sidebar/use-worktree-card-activation-actions.tssrc/renderer/src/components/sidebar/use-worktree-card-secondary-details.tssrc/renderer/src/components/sidebar/use-worktree-context-menu-commands.tssrc/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.test.tssrc/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.tssrc/renderer/src/components/sidebar/worktree-list/drag/use-status-mutations.tssrc/renderer/src/store/slices/worktrees-linked-review-push-target.test.tssrc/renderer/src/store/slices/worktrees-metadata-persistence.test.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.tssrc/renderer/src/store/slices/worktrees/session/worktree-pin-reveal.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/components/sidebar/use-worktree-card-secondary-details.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
… identities The canonical identity store landed write-only: getWorktreeMetaForHost had no production callers while setWorktreeMetaForHost kept the legacy projection only for the first known owner, so a second host's edits persisted and were never read back. Wire the listing paths through host-qualified reads. An ambiguous alias was also unrecoverable — reads returned undefined and writes threw forever, and the throw escaped the detected-worktree loop, emptying the whole repo's sidebar. Fail open onto the most recently active instance instead. - collapse ambiguous aliases deterministically and persist the repair - reclaim identity rows in the metadata GC so they cannot outlive their locator or resurrect onto a worktree recreated at the same path - drop every host's rows when a locator is removed outright, not just the owner's - honour an explicit instanceId so the stale-lineage rotation guard still works - scope a rename to the moving host; other hosts keep their own locator - prefer the project host setup matching the repo's own execution host, so a repoId registered on two hosts no longer stamps the wrong one durably - reject an unencoded `|` in a host id, the invariant the alias delimiter needs - drop the never-populated hostGeneration from the canonical key
465a6dd to
1761fdc
Compare
|
Risk-reduction follow-up in 1761fdc:
@coderabbitai review |
|
✅ Action performedReview finished.
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d4c3a46f-772f-4dbe-9ca4-e8c097e3db15
📒 Files selected for processing (62)
src/cli/help.tssrc/cli/index.test.tssrc/cli/selectors.tssrc/main/ipc/workspace-cleanup-scan.tssrc/main/ipc/worktree-metadata-merge.test.tssrc/main/ipc/worktree-metadata-merge.tssrc/main/ipc/worktrees-create-metadata-persistence.test.tssrc/main/ipc/worktrees-test-harness.tssrc/main/ipc/worktrees-test-ipc-surface.tssrc/main/ipc/worktrees/listing/register-worktree-catalog-handlers.tssrc/main/ipc/worktrees/listing/ssh-worktree-fallback.tssrc/main/ipc/worktrees/listing/worktree-discovery-metadata.tssrc/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.tssrc/main/persistence-repo-lifecycle.test.tssrc/main/persistence/host-qualified-worktree-meta.tssrc/main/persistence/loading-store/metadata-lineage-operations.tssrc/main/persistence/loading-store/worktree-identity-metadata.tssrc/main/persistence/tracking-repos/repo-worktree-pruning.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.test.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/repo-worktree-row-resolution.test.tssrc/main/runtime/repo-worktree-row-resolution.tssrc/main/runtime/worktree-scan-admin-fingerprint-gate.test.tssrc/main/workspace-space-repo-scan.tssrc/main/worktree-identity-persistence.test.tssrc/main/worktree-metadata-ownership.test.tssrc/preload/api/worktree-api.tssrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsxsrc/renderer/src/components/sidebar/WorkspaceKanbanDrawer.search.test.tsxsrc/renderer/src/components/sidebar/WorktreeList.status-lane-lineage-drop.test.tsxsrc/renderer/src/components/sidebar/WorktreeMetaDialog.test.tsxsrc/renderer/src/components/sidebar/WorktreeMetaDialog.tsxsrc/renderer/src/components/sidebar/use-workspace-kanban-status-actions.tssrc/renderer/src/components/sidebar/use-workspace-kanban-worktree-actions.tssrc/renderer/src/components/sidebar/use-worktree-card-activation-actions.tssrc/renderer/src/components/sidebar/use-worktree-card-foundation.tssrc/renderer/src/components/sidebar/use-worktree-card-secondary-details.tssrc/renderer/src/components/sidebar/use-worktree-context-menu-commands.tssrc/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.test.tssrc/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.tssrc/renderer/src/components/sidebar/worktree-list/drag/use-status-mutations.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktree-meta-update-application.tssrc/renderer/src/store/slices/worktrees-linked-review-push-target.test.tssrc/renderer/src/store/slices/worktrees-metadata-persistence.test.tssrc/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.tssrc/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.tssrc/renderer/src/store/slices/worktrees/listing/worktree-meta-host-match.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.tssrc/renderer/src/store/slices/worktrees/session/worktree-pin-reveal.tssrc/shared/execution-host.test.tssrc/shared/execution-host.tssrc/shared/persisted-state-types.tssrc/shared/project-host-setup-projection.test.tssrc/shared/project-host-setup-projection.tssrc/shared/runtime-client-export-parity.test.tssrc/shared/worktree/identity.test.tssrc/shared/worktree/identity.tssrc/shared/worktree/types.ts
🚧 Files skipped from review as they are similar to previous changes (60)
- src/renderer/src/components/sidebar/use-worktree-card-foundation.ts
- src/main/worktree-metadata-ownership.test.ts
- src/main/ipc/worktrees-test-harness.ts
- src/main/ipc/worktrees-test-ipc-surface.ts
- src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
- src/renderer/src/components/sidebar/use-worktree-card-secondary-details.ts
- src/shared/runtime-client-export-parity.test.ts
- src/main/runtime/orca-runtime.ts
- src/shared/execution-host.ts
- src/main/persistence/host-qualified-worktree-meta.ts
- src/cli/help.ts
- src/cli/index.test.ts
- src/shared/execution-host.test.ts
- src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts
- src/renderer/src/components/sidebar/use-worktree-card-activation-actions.ts
- src/shared/worktree/types.ts
- src/cli/selectors.ts
- src/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.test.ts
- src/renderer/src/components/sidebar/WorktreeMetaDialog.tsx
- src/renderer/src/components/sidebar/use-worktree-context-menu-commands.ts
- src/main/persistence/tracking-repos/worktree-metadata-normalization.ts
- src/shared/project-host-setup-projection.ts
- src/renderer/src/components/sidebar/use-workspace-kanban-status-actions.ts
- src/renderer/src/components/sidebar/use-workspace-kanban-worktree-actions.ts
- src/main/persistence/tracking-repos/repo-worktree-pruning.ts
- src/renderer/src/components/sidebar/WorktreeMetaDialog.test.tsx
- src/shared/project-host-setup-projection.test.ts
- src/main/persistence/tracking-repos/worktree-metadata-normalization.test.ts
- src/main/persistence/loading-store/worktree-identity-metadata.ts
- src/renderer/src/components/sidebar/WorkspaceKanbanDrawer.search.test.tsx
- src/renderer/src/components/sidebar/WorktreeList.status-lane-lineage-drop.test.tsx
- src/renderer/src/store/slices/worktrees/listing/worktree-meta-host-match.ts
- src/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.ts
- src/shared/worktree/identity.test.ts
- src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts
- src/renderer/src/store/slices/worktrees/session/worktree-pin-reveal.ts
- src/main/runtime/repo-worktree-row-resolution.test.ts
- src/main/persistence/loading-store/metadata-lineage-operations.ts
- src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsx
- src/main/ipc/workspace-cleanup-scan.ts
- src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts
- src/renderer/src/store/slices/worktree-helpers.ts
- src/main/ipc/worktrees-create-metadata-persistence.test.ts
- src/renderer/src/store/slices/worktrees-linked-review-push-target.test.ts
- src/main/runtime/repo-worktree-row-resolution.ts
- src/main/worktree-identity-persistence.test.ts
- src/main/persistence-repo-lifecycle.test.ts
- src/renderer/src/components/sidebar/worktree-list/drag/use-status-mutations.ts
- src/main/ipc/worktrees/listing/worktree-discovery-metadata.ts
- src/preload/api/worktree-api.ts
- src/shared/worktree/identity.ts
- src/shared/persisted-state-types.ts
- src/main/workspace-space-repo-scan.ts
- src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts
- src/renderer/src/components/sidebar/workspace-kanban-sidebar-drop.ts
- src/main/ipc/worktree-metadata-merge.ts
- src/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.ts
- src/renderer/src/store/slices/worktree-meta-update-application.ts
- src/main/ipc/worktree-metadata-merge.test.ts
- src/main/runtime/worktree-scan-admin-fingerprint-gate.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
|
Additional high-risk routing fixes in 71c305d:
The remaining known risks are stale-metadata GC, SSH target reassignment migration, and board-drag identity propagation; these remain explicitly out of the merge-safe set pending follow-up. |
|
Follow-up in 34de2e6: stale local metadata GC is now explicitly host-scoped, with a regression proving a colliding SSH identity row survives local cleanup. Focused normalization suite passes 7/7. |
|
Follow-up: SSH target readoption now rekeys canonical worktree identity aliases and metadata from the old host id to the new host id, preserving identity-only workspace metadata across target replacement. Typecheck and persistence lifecycle tests pass. |
|
Follow-up: board projection now removes duplicate raw locator ids from its mutation lookup map. Colliding local/SSH rows remain visible but board status/pin/reorder actions fail closed instead of selecting an arbitrary host. Changed-code quality is clean and board-drop tests pass 16/16. |
|
Latest follow-up (5cbfe43): catalog listing now snapshots metadata once for all non-folder repositories, including local-only fleets. This removes repeated store reads identified in review; fallback listing tests remain green. |
|
Latest follow-up in 68c9c60: board drops now persist neighboring manual-order ranks as well as dragged rows, preserving the full reorder operation. Board-drop tests pass 16/16. |
|
Latest commits are ready for final review; please re-run the review against HEAD 68c9c60. Remaining known rename behavior is intentionally fail-preserving for shared legacy lineage/session state when persisted owner differs from the explicit host. |
|
Final tiny follow-up in 2b2028c: extracted the ambiguous board-id mutation index into a named helper and added focused tests proving duplicate raw locator IDs are removed while unique IDs remain routable. Local validation: |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bb150f7a-922b-4723-8eb5-e28f8ec626ef
📒 Files selected for processing (13)
src/main/ipc/worktrees-windows.test.tssrc/main/ipc/worktrees/listing/register-worktree-catalog-handlers.tssrc/main/persistence/leasing-ssh-ptys/ssh-target-reassignment.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.test.tssrc/main/persistence/tracking-repos/worktree-metadata-normalization.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/sidebar/use-workspace-kanban-board-projection.tssrc/renderer/src/components/sidebar/use-workspace-kanban-worktree-actions.tssrc/renderer/src/components/sidebar/worktree-unambiguous-id-index.test.tssrc/renderer/src/components/sidebar/worktree-unambiguous-id-index.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.tssrc/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
* fix(workspaces): add collision-safe worktree identity * fix(workspaces): read worktree metadata per host and repair ambiguous identities The canonical identity store landed write-only: getWorktreeMetaForHost had no production callers while setWorktreeMetaForHost kept the legacy projection only for the first known owner, so a second host's edits persisted and were never read back. Wire the listing paths through host-qualified reads. An ambiguous alias was also unrecoverable — reads returned undefined and writes threw forever, and the throw escaped the detected-worktree loop, emptying the whole repo's sidebar. Fail open onto the most recently active instance instead. - collapse ambiguous aliases deterministically and persist the repair - reclaim identity rows in the metadata GC so they cannot outlive their locator or resurrect onto a worktree recreated at the same path - drop every host's rows when a locator is removed outright, not just the owner's - honour an explicit instanceId so the stale-lineage rotation guard still works - scope a rename to the moving host; other hosts keep their own locator - prefer the project host setup matching the repo's own execution host, so a repoId registered on two hosts no longer stamps the wrong one durably - reject an unencoded `|` in a host id, the invariant the alias delimiter needs - drop the never-populated hostGeneration from the canonical key * fix(workspaces): close remaining identity review gaps * fix(workspaces): close remaining review gaps * fix(workspaces): address review and CI regressions * test(workspaces): update host-qualified metadata expectations * fix(workspaces): preserve ambiguous identity records * fix(workspaces): snapshot metadata during listing * test(workspaces): mirror listing metadata snapshot in windows fixture * fix(workspaces): preserve identity routing for metadata writes * fix(workspaces): scope stale metadata cleanup by host * fix(workspaces): rekey identities on SSH readoption * fix(workspaces): fail closed for ambiguous board ids * perf(workspaces): snapshot metadata across catalog listing * fix(workspaces): retain neighboring manual order updates * test(workspaces): cover ambiguous board id index * fix(persistence): harden host-qualified worktree metadata * refactor(shared): split project host setup lookup * refactor(workspaces): simplify host-qualified metadata (cherry picked from commit b241a68)
* fix(workspaces): add collision-safe worktree identity * fix(workspaces): read worktree metadata per host and repair ambiguous identities The canonical identity store landed write-only: getWorktreeMetaForHost had no production callers while setWorktreeMetaForHost kept the legacy projection only for the first known owner, so a second host's edits persisted and were never read back. Wire the listing paths through host-qualified reads. An ambiguous alias was also unrecoverable — reads returned undefined and writes threw forever, and the throw escaped the detected-worktree loop, emptying the whole repo's sidebar. Fail open onto the most recently active instance instead. - collapse ambiguous aliases deterministically and persist the repair - reclaim identity rows in the metadata GC so they cannot outlive their locator or resurrect onto a worktree recreated at the same path - drop every host's rows when a locator is removed outright, not just the owner's - honour an explicit instanceId so the stale-lineage rotation guard still works - scope a rename to the moving host; other hosts keep their own locator - prefer the project host setup matching the repo's own execution host, so a repoId registered on two hosts no longer stamps the wrong one durably - reject an unencoded `|` in a host id, the invariant the alias delimiter needs - drop the never-populated hostGeneration from the canonical key * fix(workspaces): close remaining identity review gaps * fix(workspaces): close remaining review gaps * fix(workspaces): address review and CI regressions * test(workspaces): update host-qualified metadata expectations * fix(workspaces): preserve ambiguous identity records * fix(workspaces): snapshot metadata during listing * test(workspaces): mirror listing metadata snapshot in windows fixture * fix(workspaces): preserve identity routing for metadata writes * fix(workspaces): scope stale metadata cleanup by host * fix(workspaces): rekey identities on SSH readoption * fix(workspaces): fail closed for ambiguous board ids * perf(workspaces): snapshot metadata across catalog listing * fix(workspaces): retain neighboring manual order updates * test(workspaces): cover ambiguous board id index * fix(persistence): harden host-qualified worktree metadata * refactor(shared): split project host setup lookup * refactor(workspaces): simplify host-qualified metadata
ELI5
Orca used a repository path as if it uniquely identified a worktree everywhere. But a local machine and an SSH host can both have the same repository at the same path, so Orca could confuse the two and apply metadata or actions to the wrong one.
This PR gives each checkout a stable identity that includes both its execution host and its own persistent instance ID. Orca can now distinguish “this checkout on my laptop” from “the checkout at the same path on the SSH host,” while continuing to use the existing path-based ID anywhere Git or the filesystem requires it.
What Changed
wt2:<host>:<instance>worktree identity derived from the execution host and persisted checkoutinstanceId.repoId::pathvalue as the Git/filesystem locator and addedidentity:<identity>as an exact CLI/runtime selector.Why
Worktree.idis a path-derived locator, not a globally unique identity. Two execution hosts can legitimately publish the same locator. Before this change, a bare-ID read or mutation could select, overwrite, prune, or remove another host's workspace metadata.The migration is deliberately additive: identity and ownership use the new host/instance key, while Git and filesystem operations continue receiving the established locator. This avoids a breaking replacement of existing IPC, RPC, CLI, and persisted-state contracts.
Code Elegance and Size
The size concern was valid, so the final pass separated production code from tests/support and removed redundant abstractions:
Why Merge Risk Is Low
MERGEABLEwith merge stateCLEAN.The remaining risk is deliberately bounded: older builds retain their pre-existing ambiguity when they do not understand canonical identity, and broader session/editor/browser raw-ID migration is still a follow-up. Neither changes the established behavior for ordinary non-colliding worktrees.
How Backward Compatibility Works
Worktree.id, Git/filesystem paths, andid:<repo-id>::<path>selectors are unchanged. Existing callers keep working when the locator is unambiguous.identity:<identity>provides exact routing without removing or changing existing selector syntax.instanceId, while retaining the legacy metadata projection for older builds.Cross-version wire compatibility is covered by 5/5 passing tests. The change supports local worktrees, folder workspaces, SSH hosts, relays, and independently updated client/host deployments.
Linked Issue
Part of #10287.
This PR covers collision-safe worktree metadata, discovery, persistence, and mutation routing. Broader raw-ID migration for session, editor, and browser state remains staged follow-up work.
Visual Proof
N/A — this changes identity, persistence, routing, recovery, and CLI contracts; it does not add or alter a visual surface. The user-visible behavior is covered by multi-host collision and metadata-routing tests.
Testing
pnpm tcpassed.oxlint --format githubcompleted with 0 findings.pnpm run check:code-quality:changedcompleted with 0 findings.git diff --checkpassed.ssh2mock failures, a Windows gyp patch absent from localnode_modules, and one interactive zsh timeout that passed immediately in isolation. The post-cleanup focused suite and authoritative final-head CI are green.Review
reviewDecision: null), but GitHub does not report it as a merge blocker.Agent skill upstream boundary
Scope Boundaries / Follow-ups
Checklist