Repository navigation
refactor(git): git calls route by the worktree's owner - #27291
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to Copy Remote URL silently does nothing when file ownership cannot be resolved. This affects a narrow workflow, and refreshing the workspace and retrying is a bounded workaround; the remaining risk is low. Pre-merge checks |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts (1)
275-275: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value
runtimeTargetForWorktreeOwnerthrows outside the{ ok, error }contract.Line 275 evaluates
runtimeTargetForWorktreeOwner(get(), worktreeId, executionHostId)inside thetry. Thecatchhandles it, so the function still returns{ ok: false, error }. The failure is only reported after the optimisticsethas been applied. Thecatchthen refetches worktrees to revert it. This is acceptable. However, thecatchlogs the ambiguity error withconsole.error('Failed to update worktree meta:'). Consider resolving the owner target before the optimisticset. The update would then fail fast without a write or revert flicker.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2dc434da-0f8d-469e-bf3d-a145be2b6e5a
📥 Commits
Reviewing files that changed from the base of the PR and between 7de3710 and 2f8b06523186d2868cec817eae978d5e20792eb3.
📒 Files selected for processing (145)
config/focus-setting-read-baseline.txtconfig/owner-routing-baseline.txtsrc/renderer/src/components/editor/MonacoGutterContextMenu.tsxsrc/renderer/src/components/editor/combined-diff/load-sections/fetch-combined-diff-section.tssrc/renderer/src/components/editor/editor-file-git-target.tssrc/renderer/src/components/editor/useEditorPanelContentState.test.tsxsrc/renderer/src/components/editor/useEditorPanelDiffContentLoader.tssrc/renderer/src/components/editor/useEditorPanelVisibilityContentState.test.tsxsrc/renderer/src/components/native-chat/native-chat-session-option-discovery.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.tssrc/renderer/src/components/right-sidebar/SourceControl.commit-generation-records.test.tssrc/renderer/src/components/right-sidebar/SourceControl.pr-generation-records.test.tssrc/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel/manual-refresh-dependencies.tssrc/renderer/src/components/right-sidebar/checks-panel/review-state-dependencies.tssrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-branch-actions.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-composer-state.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-controller-state.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-generation.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-generation.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-git-status-effects.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-git-status-effects.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-review-state.tsxsrc/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.tssrc/renderer/src/components/right-sidebar/git-status-refresh-branch-line-total.test.tssrc/renderer/src/components/right-sidebar/git-status-refresh.test.tssrc/renderer/src/components/right-sidebar/git-status-refresh.tssrc/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.test.tssrc/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.tssrc/renderer/src/components/right-sidebar/source-control/ai/controller-types.tssrc/renderer/src/components/right-sidebar/source-control/ai/use-ai.tssrc/renderer/src/components/right-sidebar/source-control/commit/discard-all-failure-description.test.tsxsrc/renderer/src/components/right-sidebar/source-control/commit/source-control-discard-editor-owner.test.tsxsrc/renderer/src/components/right-sidebar/source-control/commit/source-control-entry-mutation-failures.test.tsxsrc/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions-capped-stage.test.tsxsrc/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.tssrc/renderer/src/components/right-sidebar/source-control/commit/use-commit-action.tssrc/renderer/src/components/right-sidebar/source-control/commit/use-commit-flows.tssrc/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.tssrc/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.tssrc/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.tssrc/renderer/src/components/right-sidebar/source-control/listing/operation-target.tssrc/renderer/src/components/right-sidebar/source-control/listing/use-file-listing.tssrc/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.tssrc/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.tssrc/renderer/src/components/right-sidebar/source-control/panel/use-panel-foundation.tssrc/renderer/src/components/right-sidebar/source-control/panel/use-panel-model.tssrc/renderer/src/components/right-sidebar/source-control/panel/use-panel-state.tssrc/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-run-snapshot.tssrc/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-commit-message.tssrc/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-flows.tssrc/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-probes.tssrc/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-review.tssrc/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-target.tssrc/renderer/src/components/right-sidebar/source-control/review/use-create-review-composer.tssrc/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.test.tsxsrc/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.test.tsxsrc/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.tssrc/renderer/src/components/right-sidebar/source-control/review/use-review-context.tssrc/renderer/src/components/right-sidebar/source-control/review/use-review-flows.tssrc/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.tssrc/renderer/src/components/right-sidebar/source-control/sync/use-conflict-abort.tssrc/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.tssrc/renderer/src/components/right-sidebar/source-control/sync/use-git-history.tssrc/renderer/src/components/right-sidebar/source-control/sync/use-remote-action-runner.tssrc/renderer/src/components/right-sidebar/source-control/sync/use-status-refresh.local-ignore.test.tsxsrc/renderer/src/components/right-sidebar/source-control/sync/use-status-refresh.tssrc/renderer/src/components/right-sidebar/source-control/sync/use-upstream-status-fetch.tssrc/renderer/src/components/right-sidebar/stale-conflict-operation-poll.tssrc/renderer/src/components/right-sidebar/use-create-pull-request-base-ref-discovery.tssrc/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.tssrc/renderer/src/components/right-sidebar/use-file-explorer-ignored-paths.tssrc/renderer/src/components/right-sidebar/use-git-status-upstream-ref-watch.test.tssrc/renderer/src/components/right-sidebar/use-git-status-upstream-ref-watch.tssrc/renderer/src/components/right-sidebar/use-source-control-ai.test.tssrc/renderer/src/components/right-sidebar/use-source-control-branch-compare.test.tsxsrc/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsxsrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.repo-default.test.tssrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.test.tssrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.tssrc/renderer/src/components/right-sidebar/useFileExplorerVisibleRowProjection.debounce.test.tsxsrc/renderer/src/components/right-sidebar/useGitStatusPolling.test.tssrc/renderer/src/components/right-sidebar/useGitStatusPolling.tssrc/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsxsrc/renderer/src/components/right-sidebar/worktree-git-owner-target.tssrc/renderer/src/components/settings/CommitMessageAiPane.test.tsxsrc/renderer/src/components/settings/CommitMessageAiPane.tsxsrc/renderer/src/components/settings/RepositoryForkSyncSection.tsxsrc/renderer/src/components/sidebar/use-delete-worktree-status-hydration.tssrc/renderer/src/components/status-bar/use-workspace-space-git-refresh-action.tssrc/renderer/src/hooks/composer-state/github-provider-selection.tssrc/renderer/src/hooks/composer-state/github-submit-resolution.tssrc/renderer/src/lib/github-pr-start-point.test.tssrc/renderer/src/lib/github-pr-start-point.tssrc/renderer/src/lib/launch-work-item-direct-preflight.tssrc/renderer/src/lib/launch-work-item-direct.tssrc/renderer/src/runtime/antigravity-generation-compatibility.test.tssrc/renderer/src/runtime/antigravity-generation-compatibility.tssrc/renderer/src/runtime/runtime-git-client-branch-line-total.test.tssrc/renderer/src/runtime/runtime-git-client-context.tssrc/renderer/src/runtime/runtime-git-client-merge.test.tssrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-diff-client.tssrc/renderer/src/runtime/runtime-git-generation-client.tssrc/renderer/src/runtime/runtime-git-status-client.tssrc/renderer/src/runtime/runtime-git-sync-client.tssrc/renderer/src/runtime/runtime-git-working-tree-client.tssrc/renderer/src/runtime/runtime-git-worktree-scope-client.test.tssrc/renderer/src/store/repos/all-host-repo-catalog-actions.tssrc/renderer/src/store/repos/repo-catalog-actions.tssrc/renderer/src/store/repos/runtime-repo-catalog-actions.tssrc/renderer/src/store/repos/safe-auto-fork-sync.test.tssrc/renderer/src/store/repos/safe-auto-fork-sync.tssrc/renderer/src/store/slices/commit-message-generation.tssrc/renderer/src/store/slices/diff-comment-persistence.tssrc/renderer/src/store/slices/diffComments.test.tssrc/renderer/src/store/slices/editor-remote-branch-actions.test.tssrc/renderer/src/store/slices/editor/actions/git-operation-target.tssrc/renderer/src/store/slices/editor/actions/git-remote-push-pull.tssrc/renderer/src/store/slices/editor/actions/git-remote-status.tssrc/renderer/src/store/slices/editor/actions/git-remote-sync.tssrc/renderer/src/store/slices/editor/types/git-runtime-operation.tssrc/renderer/src/store/slices/generation-records-worktree-removal-leak.test.tssrc/renderer/src/store/slices/pull-request-generation.tssrc/renderer/src/store/slices/worktrees-activity-persistence.test.tssrc/renderer/src/store/slices/worktrees-lineage-state.test.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/fetch-worktrees.tssrc/renderer/src/store/slices/worktrees/listing/worktree-owner-settings.tssrc/renderer/src/store/slices/worktrees/listing/worktree-owner-target.tssrc/renderer/src/store/slices/worktrees/listing/worktree-slice-types.tssrc/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target-ensure.tssrc/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.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-git-identity-update.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.test.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.tssrc/renderer/src/store/slices/worktrees/session/worktree-unread-activity.ts
💤 Files with no reviewable changes (1)
- config/owner-routing-baseline.txt
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
2f8b065 to
1326f68
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
92d34304-2371-4560-8c53-9c208e1e32f9
📥 Commits
Reviewing files that changed from the base of the PR and between 2f8b06523186d2868cec817eae978d5e20792eb3 and 1326f68ef641aa2308da373c679f309119b4812c.
📒 Files selected for processing (5)
config/focus-setting-read-baseline.txtconfig/owner-routing-baseline.txtsrc/renderer/src/components/editor/MonacoGutterContextMenu.tsxsrc/renderer/src/components/editor/combined-diff/load-sections/fetch-combined-diff-section.tssrc/renderer/src/components/editor/useEditorPanelDiffContentLoader.ts
💤 Files with no reviewable changes (1)
- config/owner-routing-baseline.txt
🚧 Files skipped from review as they are similar to previous changes (1)
- config/focus-setting-read-baseline.txt
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
| if (!target) { | ||
| return | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Show the unresolved-owner message for Copy Remote URL.
If target is null, this action returns without feedback. The user cannot tell why the URL was not copied. Show “The workspace host is unresolved. Refresh the workspace and retry.” before returning. This also satisfies the PR’s stated behavior for unresolved-owner user actions.
a19e73a to
8c9ddd4
Compare
RuntimeGitContext carries the owner's transport (target) instead of a settings object, so raw focus settings no longer compile at a git call. Source control, the checks panel, diff loaders, fork sync, lineage, worktree metadata, review push targets and diff-comment persistence derive it from the repo or worktree rows (resolveOwner) or a captured owner. Editor-slice remote actions take an explicit runtimeTarget and otherwise resolve the worktree owner; an unresolved owner is refused, never sent to the focused server. Generation preferences ride a separate prefs field.
…rt point and create
8c9ddd4 to
92a0383
Compare
A fresh target literal per render re-ran base-ref discovery forever and ran the test worker out of memory.
Rebase adaptation for stablyai#27291: the runtime settings payload was replaced by worktree git owner targets, and file-explorer-runtime-owner was removed. The lane identity now keys on the resolved owner target (local vs env id) instead of activeRuntimeEnvironmentId, and the query guard from upstream (unresolved target skips the request) is preserved inside the coalescing request. Test mocks follow the new module.
Rebase adaptation for stablyai#27291: the runtime settings payload was replaced by worktree git owner targets, and file-explorer-runtime-owner was removed. The lane identity now keys on the resolved owner target (local vs env id) instead of activeRuntimeEnvironmentId, and the query guard from upstream (unresolved target skips the request) is preserved inside the coalescing request. Test mocks follow the new module.
ELI5
Git actions in Orca (status, stage, commit, push, pull, diffs, AI commit messages, fork sync, review notes) used to ask the app-wide "Active Server" setting which machine to talk to, unless the caller happened to override it. Now every git call is told which machine owns the repository or worktree it is about, so it can't drift to whatever server happens to be selected.
What Changed
RuntimeGitContextnow carriestarget: RuntimeClientTarget(the owner's connection) instead of asettingsobject, so code that passes raw focus settings no longer compiles. AI preferences ride a separateprefsfield whose type has noactiveRuntimeEnvironmentId.getRuntimeGitScopetakes the target; its scope and cache key strings are unchanged.runtimeTargetForOwnerHostId(getRepoExecutionHostId(repo))).resolveOwner→runtimeTargetForWorkspaceOwner).getRuntimeTargetForFileOwner/requireRuntimeTargetForFileOwner: the owner stamped on the tab, otherwise the worktree's owner. These are the same helpers file reads use.pushBranch,pullBranch,syncBranch,fetchBranch,rebaseFromBase,fastForwardBranch,fetchUpstreamStatus) take an optionalruntimeTargetin place ofruntimeTargetSettings. Without it they resolve the worktree's owner. An unresolved owner is refused before the busy flag is set.runtimeTargetwhen the request starts, so Stop and the follow-up refresh reach the same host.resolveDirectLaunchOwnerRow. Setup preflight, the PR start point andcreateWorktree(given that row'sexecutionHostId) all run on that host. If two hosts share the repo id, the launch opens the create modal instead of breaking the tie by focus.persistWorktreeMeta, lineage reads and writes, and the GitHub PR start-point resolver now take a target instead of settings.getRightSidebarWorktreeRuntimeSettings,getRepoOwnerRoutedSettings,settingsForWorktreeOwnerandtrySettingsForWorktreeOwnerin these paths. The privatesettingsForWorktreeOwnerin diff-comment persistence is deleted.Why
The design calls for routing by the resource's owner, never by focus. Changing the context type is the honest version of that. Swapping in a renamed helper that still reads settings would leave every caller able to pass focus. With the type change, the compiler found every git caller.
Alternatives considered:
worktreeId. Worktree ids can repeat across hosts, and the clients would need the store.settingsalongsidetarget. That would leave two routing inputs.Some cases now refuse instead of falling back to this computer:
The old fallback could act on the wrong machine.
Kept as-is on purpose, for later stack PRs:
fetchWorktreeLineage()called without a host still refreshes the focused server's lineage. It is a host-scoped refresh, not a resource.{ activeRuntimeEnvironmentId }. That value is now built from the owner target, and the repo-client area replaces it.Linked Issue
None. This is part of the host-ownership routing stack (D4 G1, area B).
Visual Proof
N/A. There is no UI change, only which host git calls go to. Unit tests cover the routing, and the machine is load-capped, so the app wasn't launched.
Testing
New or changed tests prove that the owner wins over focus:
SourceControl.preview-open.test.tsx: the repo is owned byruntime-remotewhileruntime-otheris focused, and the discard goes toruntime-remote.worktrees-lineage-state.test.ts,worktrees-metadata-persistence.test.ts,worktrees-activity-persistence.test.tsandworktrees-linked-review-push-target.test.tsnow stamp server rows the way ingest does.launch-work-item-direct-owner-row.test.ts(new):createWorktreeall on its owner.editor-remote-branch-actions.test.ts(new case): a push for a worktree that no row places is refused, makes no IPC call, and leaves the busy flag clear even with a focused server set.pnpm tc:web, focusedpnpm test(right-sidebar, runtime, store, editor, native-chat, lib, composer-state, settings, sidebar and status-bar suites),oxlint/oxfmt,pnpm run check:code-quality:changed, andpnpm check:owner-routing-ratchet.Review
Agent skill upstream boundary
Notes
No wire change: RPC methods and params are unchanged. SSH: direct SSH keeps going through this app's IPC with its
connectionId. Folder workspaces keep their existing guards, and diff comments on folders still go to the folder's own host.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)