Repository navigation
Conversation
|
Ready to review this PR? Stage has broken it down into 12 individual chapters for you: Chapters generated by Stage for commit d4c3fbb on Jun 22, 2026 8:33pm UTC. |
|
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:
📝 WalkthroughWalkthroughThis pull request migrates worktree identifiers from legacy 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/renderer/src/store/slices/repos.ts (1)
1330-1341:⚠️ Potential issue | 🟠 Major | ⚡ Quick winMatch repo rows by host-qualified identity, not
repo.idalone.These paths still treat
repo.idas globally unique. With same-id repos on different hosts, adding/setup/update/delete can reject a valid sibling, overwrite another host’s row, or remove it from state. Use(repo.id, getRepoExecutionHostId(repo))consistently, and useisSameProjectHostSetupfor setup rows insetupProjectExistingFolder.🐛 Proposed direction
function isSameProjectHostSetup(a: ProjectHostSetup, b: ProjectHostSetup): boolean { return a.id === b.id && a.hostId === b.hostId } + +function isSameRepoIdentity( + a: Pick<Repo, 'id' | 'connectionId' | 'executionHostId'>, + b: Pick<Repo, 'id' | 'connectionId' | 'executionHostId'> +): boolean { + return a.id === b.id && getRepoExecutionHostId(a) === getRepoExecutionHostId(b) +} @@ - const alreadyAdded = get().repos.some((r) => r.id === repo.id) + const alreadyAdded = get().repos.some((r) => isSameRepoIdentity(r, repo)) @@ - if (s.repos.some((r) => r.id === repo.id)) { + if (s.repos.some((r) => isSameRepoIdentity(r, repo))) { return s } @@ - const nextRepos = s.repos.some((entry) => entry.id === repo.id) - ? s.repos.map((entry) => (entry.id === repo.id ? repo : entry)) + const nextRepos = s.repos.some((entry) => isSameRepoIdentity(entry, repo)) + ? s.repos.map((entry) => (isSameRepoIdentity(entry, repo) ? repo : entry)) : [...s.repos, repo] @@ - const nextSetups = s.projectHostSetups.some((entry) => entry.id === setup.id) - ? s.projectHostSetups.map((entry) => (entry.id === setup.id ? setup : entry)) + const nextSetups = s.projectHostSetups.some((entry) => + isSameProjectHostSetup(entry, setup) + ) + ? s.projectHostSetups.map((entry) => + isSameProjectHostSetup(entry, setup) ? setup : entry + ) : [...s.projectHostSetups, setup] @@ - ? s.repos.some((entry) => entry.id === repo.id) - ? s.repos.map((entry) => (entry.id === repo.id ? repo : entry)) + ? s.repos.some((entry) => isSameRepoIdentity(entry, repo)) + ? s.repos.map((entry) => (isSameRepoIdentity(entry, repo) ? repo : entry)) : [...s.repos, repo] @@ - const repos = repo ? s.repos.filter((entry) => entry.id !== repo.id) : s.repos + const repos = repo + ? s.repos.filter((entry) => !isSameRepoIdentity(entry, repo)) + : s.reposAlso applies to: 1390-1398, 1479-1482, 1528-1528
src/main/usage-worktree-metadata.ts (1)
25-33:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftHost collisions still collapse usage state by
repo.id.Line 26/31 keys usage buckets by
repo.idonly. With same-id repos on different hosts, one host overwrites the other and later metadata can be attributed to the wrong repo host. This path needs host-qualified bucketing (e.g.,(hostId, repoId)) end-to-end.Also applies to: 38-39, 53-59
src/main/ipc/worktrees.ts (1)
579-586:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMissing
hostIdinmergeWorktreecall for disconnected SSH worktrees.Other discovery paths (e.g.,
buildDetectedGitWorktreesat line 602-604,stampAndMergeVisibleDetectedWorktreeat line 638-640) now pass{ hostId: getRepoExecutionHostId(repo) }tomergeWorktree. This call is missing that option, which could result in inconsistent worktree identity for disconnected SSH repos.Proposed fix
const worktree = mergeWorktree( repo.id, synthesizeSshGitWorktree(repo, candidate.path, meta), - meta + meta, + repo.displayName, + { hostId: getRepoExecutionHostId(repo) } )
🧹 Nitpick comments (4)
src/renderer/src/store/slices/project-host-setup-compatibility-merge.test.ts (1)
13-13: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winUse path utilities for fixture paths.
These fixture paths hard-code
/; usenode:pathso the test stays cross-platform.♻️ Proposed change
+import { join } from 'node:path' import { describe, expect, it } from 'vitest' @@ - path: `/${hostId}/${id}`, + path: join('/', hostId, id), @@ - path: `/${hostId}/${repoId}`, + path: join('/', hostId, repoId),As per coding guidelines, “Use
path.joinor Electron/Node path utilities for file paths — never assume/or\for cross-platform compatibility.”Also applies to: 33-33
Source: Coding guidelines
src/renderer/src/components/settings/RepositoryHostSetupsSection.tsx (1)
27-29: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winAdd a one-line rationale for the composite setup key format.
Line 27 builds a
hostId + '\0' + idkey, which is a non-obvious constraint for same-id cross-host disambiguation. Please add a brief “why” comment to prevent accidental regressions.As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”
Source: Coding guidelines
src/main/ipc/remote-workspace.ts (1)
261-268: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider: the host-ID validation appears tautological.
makeRepoWorktreeKey(repo, worktreePath)already embedsgetRepoExecutionHostId(repo)into the canonical key. The subsequent check thatsplitWorktreeId(candidate)?.hostId === getRepoExecutionHostId(repo)will therefore always be true for any candidate produced by that call.This is harmless defensive coding, but if intentional as a guard against future refactors, a brief comment explaining the invariant would help future readers understand the purpose.
src/main/runtime/orca-runtime.test.ts (1)
1794-1803: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winExtract a small canonical-ID test helper to reduce repeated setup drift.
Line 1794 and similar blocks duplicate
makeWorktreeKeyobject literals across many tests. A helper keeps host/repo/path shape consistent and makes failures easier to read.Proposed refactor
+const mkCanonicalWorktreeId = (hostId: string, repoId: string, path: string) => + makeWorktreeKey({ hostId, repoId, path }) -const canonicalMainId = makeWorktreeKey({ - hostId: 'ssh:ssh-missing', - repoId: remoteRepo.id, - path: '/home/user/repo' -}) +const canonicalMainId = mkCanonicalWorktreeId('ssh:ssh-missing', remoteRepo.id, '/home/user/repo')Also applies to: 2791-2797, 2836-2845, 14744-14748, 15561-15570, 15875-15884, 16331-16340, 21136-21140
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 73b5ae60-4c50-492c-8a89-161f484e3991
📒 Files selected for processing (51)
docs/worktree-host-identity-rollout-validation.mdsrc/main/daemon/pty-session-id.test.tssrc/main/ipc/remote-workspace.tssrc/main/ipc/repos.tssrc/main/ipc/workspace-cleanup.test.tssrc/main/ipc/workspace-cleanup.tssrc/main/ipc/worktree-metadata-merge.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.test.tssrc/main/ipc/worktrees.tssrc/main/memory/hydrate-local-pty-registry.test.tssrc/main/memory/hydrate-local-pty-registry.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/project-runtime-rpc-methods.tssrc/main/runtime/worktree-teardown.tssrc/main/usage-worktree-metadata.tssrc/main/workspace-space-analysis.tssrc/renderer/src/components/settings/McpConfigSection.tsxsrc/renderer/src/components/settings/RepositoryHostSetupsSection.test.tsxsrc/renderer/src/components/settings/RepositoryHostSetupsSection.tsxsrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/hooks/worktree-change-refresh-queue.tssrc/renderer/src/lib/project-host-workspace-target.test.tssrc/renderer/src/lib/project-host-workspace-target.tssrc/renderer/src/lib/repo-runtime-owner.test.tssrc/renderer/src/lib/repo-runtime-owner.tssrc/renderer/src/lib/worktree-runtime-owner.test.tssrc/renderer/src/lib/worktree-runtime-owner.tssrc/renderer/src/store/slices/project-host-setup-compatibility-merge.test.tssrc/renderer/src/store/slices/project-host-setup-compatibility-merge.tssrc/renderer/src/store/slices/repo-host-refresh-merge.test.tssrc/renderer/src/store/slices/repo-host-refresh-merge.tssrc/renderer/src/store/slices/repo-identity-reconcile.test.tssrc/renderer/src/store/slices/repo-identity-reconcile.tssrc/renderer/src/store/slices/repo-reorder-host-split.test.tssrc/renderer/src/store/slices/repo-reorder-host-split.tssrc/renderer/src/store/slices/repos-multi-host-refresh.test.tssrc/renderer/src/store/slices/repos-project-host-lifecycle.test.tssrc/renderer/src/store/slices/repos-same-id-host-mutations.test.tssrc/renderer/src/store/slices/repos.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktrees.test.tssrc/renderer/src/store/slices/worktrees.tssrc/shared/pty-session-id-format.tssrc/shared/types.tssrc/shared/worktree-id.test.tssrc/shared/worktree-id.ts
d4c3fbb to
d69c2ad
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: cbf61708-1b61-4919-b73b-7482f98a3d8c
📒 Files selected for processing (31)
docs/worktree-host-identity-rollout-validation.mdsrc/main/claude-usage/scanner.tssrc/main/codex-usage/scanner.tssrc/main/daemon/pty-session-id.test.tssrc/main/ipc/remote-workspace.tssrc/main/ipc/repos.tssrc/main/ipc/workspace-cleanup.test.tssrc/main/ipc/workspace-cleanup.tssrc/main/ipc/worktree-logic.test.tssrc/main/ipc/worktree-metadata-merge.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees-windows.test.tssrc/main/ipc/worktrees.test.tssrc/main/ipc/worktrees.tssrc/main/memory/hydrate-local-pty-registry.test.tssrc/main/memory/hydrate-local-pty-registry.tssrc/main/opencode-usage/scanner.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/project-runtime-rpc-methods.tssrc/main/runtime/runtime-rpc.test.tssrc/main/runtime/worktree-teardown.tssrc/main/usage-worktree-metadata.test.tssrc/main/usage-worktree-metadata.tssrc/main/workspace-space-analysis.test.tssrc/main/workspace-space-analysis.tssrc/renderer/src/components/settings/McpConfigSection.tsxsrc/renderer/src/components/settings/RepositoryHostSetupsSection.test.tsxsrc/renderer/src/components/settings/RepositoryHostSetupsSection.tsx
💤 Files with no reviewable changes (5)
- src/renderer/src/components/settings/McpConfigSection.tsx
- src/main/workspace-space-analysis.test.ts
- src/main/workspace-space-analysis.ts
- src/renderer/src/components/settings/RepositoryHostSetupsSection.test.tsx
- src/renderer/src/components/settings/RepositoryHostSetupsSection.tsx
✅ Files skipped from review due to trivial changes (1)
- docs/worktree-host-identity-rollout-validation.md
🚧 Files skipped from review as they are similar to previous changes (17)
- src/main/ipc/worktree-logic.test.ts
- src/main/runtime/rpc/methods/project-runtime-rpc-methods.ts
- src/main/daemon/pty-session-id.test.ts
- src/main/ipc/worktree-metadata-merge.ts
- src/main/memory/hydrate-local-pty-registry.ts
- src/main/ipc/remote-workspace.ts
- src/main/ipc/repos.ts
- src/main/persistence.test.ts
- src/main/ipc/worktrees-windows.test.ts
- src/main/runtime/runtime-rpc.test.ts
- src/main/runtime/worktree-teardown.ts
- src/main/ipc/worktree-remote.ts
- src/main/persistence.ts
- src/main/ipc/worktrees.test.ts
- src/main/ipc/worktrees.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/runtime/orca-runtime.ts
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 (1)
src/renderer/src/store/slices/repos.ts (1)
2036-2039: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winRoute host-setup mutations using
args.hostIdwhen lookup misses.If
findProjectHostSetupByMutationArgs(...)returns no match, both methods default to local target. For runtime-scoped mutations, that can dispatch update/delete to the wrong host (or wrong setup when same IDs exist across hosts).💡 Suggested fix
- const target = currentSetup - ? getProjectSetupRuntimeTarget(currentSetup.hostId) - : { kind: 'local' as const } + const target = getProjectSetupRuntimeTarget(currentSetup?.hostId ?? args.hostId)- const target = currentSetup - ? getProjectSetupRuntimeTarget(currentSetup.hostId) - : { kind: 'local' as const } + const target = getProjectSetupRuntimeTarget(currentSetup?.hostId ?? args.hostId)Also applies to: 2086-2089
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a8342a31-780a-4334-88cd-39addfca8332
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/renderer/src/store/slices/repos.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/runtime/orca-runtime.test.ts
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
fc743df to
e814b3c
Compare
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
|
Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-07-22T17:41:35Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes. |
|
Superseded by #16691, which shipped host-qualified worktree identities. Closing. |
Summary
repoId::pathIDs accepted at compatibility and persistence boundaries*ByWorktree*maps cannot be silently missedTests
pnpm run typecheckpnpm run lintgit diff --checkpnpm exec vitest run --config config/vitest.config.ts src/main/ipc/repos-remote.test.tspnpm exec vitest run --config config/vitest.config.ts src/shared/worktree-id.test.ts src/main/daemon/pty-session-id.test.ts src/main/persistence.test.ts src/main/ipc/worktrees.test.ts src/main/ipc/repos-remote.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/runtime-rpc.test.ts src/renderer/src/store/slices/repos-host-identity-routing.test.ts src/renderer/src/store/slices/repos-same-id-host-mutations.test.ts src/renderer/src/store/slices/repos-update-serialization.test.ts src/renderer/src/store/slices/repos.test.ts src/renderer/src/lib/project-host-workspace-target.test.ts src/renderer/src/store/slices/worktrees.test.ts src/main/ipc/worktree-push-target-cleanup.test.ts src/renderer/src/lib/worktree-creation-flow.test.ts(15 files, 1377 tests)window.api.app.getIdentity()reported branchcodex/host-qualified-worktree-identitiesand root/Users/jinwoohong/orca/workspaces/orca/review-orca-server-prs.demo-project: added project, created a worktree frommain, verified the visible sidebar row, verified the worktree ID wasorca-worktree://v1?...hostId=local..., verifiedgit worktree list --porcelain, then removed it through Orca and confirmed no test branch/path remained.kind: "folder"project, created a folder workspace, and verified the main and child folder workspace IDs were host-qualified withhostId=local.pnpm build:relay, connected targetssh-1782331073601-etpfjo, registered remote/work/demo-project, created/listed/removed/work/ssh-id-e2e-1782331210923, verified visible SSH project/worktree rows, and confirmed remotegit worktree list --porcelain, branch list, and/workhad no test artifacts after cleanup.OrcaRuntimeRpcServerwith real E2EE WebSocket pairing, added it throughwindow.api.runtimeEnvironments.addFromPairingCode, verifiedruntimeEnvironments.getStatus, then exercisedrepo.list,worktree.list,worktree.create, andworktree.rmthroughwindow.api.runtimeEnvironments.call. The created runtime worktree ID wasorca-worktree://v1?...hostId=runtime%3Amock-paired&repoId=mock-repo-1..., and list count returned to 1 after removal.Notes:
Made with Orca 🐋