Repository navigation
Keep worktree branches unless CLI deletion is requested - #35948
Conversation
[Medium impact] The PR appears safe to merge; no actionable defects were found. Summary
No actionable issues found. Tests were inspected, not run during this review. Compatibility note:
|
|
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.
|
There was a problem hiding this comment.
Actionable comments posted: 2

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c22bd5cd-99ac-4d9c-b7d2-7b3935059dc7
Files selected for processing: 24-
src/cli/handlers/worktree-removal-request.tssrc/cli/handlers/worktree.tssrc/cli/index.test.tssrc/cli/runtime/client-execution-host.test.tssrc/cli/runtime/client.tssrc/cli/runtime/remote-runtime-compat-gate.tssrc/cli/runtime/transport.test.tssrc/cli/runtime/transport.tssrc/cli/runtime/types.tssrc/cli/runtime/websocket-transport.test.tssrc/cli/specs/core.tssrc/cli/worktree-rm-real-git.test.tssrc/main/runtime/runtime-interrupted-local-worktree-removal.test.tssrc/main/runtime/runtime-registered-local-worktree-removal.tssrc/main/runtime/runtime-worktree-selection.test.tssrc/main/runtime/runtime-worktree-selection.tssrc/main/runtime/workspaces/workspace-lifecycle-commands.tssrc/main/runtime/workspaces/workspace-removal-target.tssrc/main/runtime/workspaces/workspace-removal.tssrc/main/worktree-background-removal.tssrc/renderer/src/web/web-preload-api-workspace-catalog.test.tssrc/shared/cli-argument-boundary.tssrc/shared/rpc-contract/worktree-params.tssrc/shared/worktree-runtime-capabilities.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
|
Worktree removal could delete its branch after the command returned. Updated hosts now keep the branch by default, including with The full source review, design settlement and convergence checks completed on Verification: 139 tests in nine named affected CLI/transport/runtime integration files passed through tc-gate after the transport merge; required merge lint-staged passed for both merges. Tests exercise actual CLI arguments through local/authenticated paired sockets, real RPC/lifecycle dispatch and temporary Git repos, covering default/force/opt-in, exact legacy requests and warnings, folders/root refusal, served routing, preparation/no-replay, restart recovery and complete failed retry/settlement. Earlier core coverage included 124 passes and 16 Windows-only skips; counts across invocations are not additive unique coverage. Final merged-head CI: 42 passing checks and 28 intentionally skipped checks, including passing static analysis/typecheck, both packages, all twelve unit shards, mobile verification and all three WSL distro checks. The branch is pushed and clean, with no conflicts or unresolved review threads. All changed flows are CLI/tests rows ( For Brennan's review: |
There was a problem hiding this comment.
Actionable comments posted: 2

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
bf04c363-ca65-454b-845c-0f7846b788e1
Files selected for processing: 18-
src/cli/handlers/worktree-removal-request.tssrc/cli/handlers/worktree.tssrc/cli/index.test.tssrc/cli/runtime/client.tssrc/cli/runtime/remote-runtime-compat-gate.tssrc/cli/runtime/transport.test.tssrc/cli/runtime/transport.tssrc/cli/runtime/types.tssrc/cli/runtime/websocket-transport.test.tssrc/cli/runtime/websocket-transport.tssrc/cli/specs/core.tssrc/main/runtime/rpc/worktree-rm-cli.integration.test.tssrc/main/runtime/rpc/worktree-rm-paired.test-fixture.tssrc/main/runtime/rpc/worktree-rm-pty.test-fixture.tssrc/shared/remote-runtime/remote-runtime-client.tssrc/shared/remote-runtime/requests/remote-runtime-request-response-router.tssrc/shared/remote-runtime/requests/remote-runtime-request-socket.tssrc/shared/runtime-rpc-envelope.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
-
orca worktree rmcould delete the worktree’s branch after the command returned. On updated hosts, removal now keeps that branch by default; use--delete-branchto request the existing safe branch cleanup.--forcedoes not imply branch deletion. Desktop deletion keeps its existing behavior.rmorrm --forcerm --delete-branchBackground acceptance is reported as removal in progress, not completed branch cleanup. Existing dirty-worktree, main-worktree, unmerged-branch and expected-head safety checks remain in force.
The CLI checks the executing host on the same connection that sends removal. A missing branch-choice capability selects the legacy request; a failed status, authentication or protocol check is an error and sends no removal. The original selector and host routing stay unchanged. Older CLIs, desktop and phone callers still omit the new field and retain their existing metadata policy.
Optional branch intent is resolved once into the removal job’s existing saved boolean. Background completion, partial recovery and restart retain that accepted choice. A conflicting choice cannot silently join or retry an accepted job. No new saved field or second cleanup operation is added.
The common pattern makes branch cleanup explicit. Intended differences are the existing metadata policy for legacy callers, host-owned completion across disconnect/restart, multiple-host routing, and safe branch cleanup that may retain unmerged or replaced work. Unserved SSH targets retain their existing refusal and do not fall back to the client’s Git.
Tracked in STA-10355.
Validation: real CLI arguments pass through local and authenticated paired sockets, the RPC dispatcher, runtime lifecycle and real temporary Git repos. The updated typed fixture uses actual folder/catalog/selector producers. Focused verification included 124 passing tests with 16 Windows-only skips, followed by 62 passing integration/transport cases and 23 passing real-runtime integration cases after fixture repairs; these are separate invocations, not additive unique-test totals. Additional targeted runs covered accepted-job recovery, complete failed retry and settlement, raw legacy payloads, status/dispatch timeouts, safe branch/head cleanup, current/WSL selection, archive hooks and unchanged desktop/web consumers. The served-environment test uses the production route with an authenticated loopback receiver and separate client repo; it does not claim a live SSH-daemon run.
QA classification is
qa=tests: CLI/transport integration and existing removal-intent recovery. No rendered UI, provider login, native-chat lifecycle or process-ownership implementation changed, so no app, agent, emulator or screenshot run is required. Final-head CI passes, including mobile, all twelve unit shards, static analysis/typecheck, Linux/Windows packaging, WSL and SSH Docker checks. The real-runtime integration also passes under the CI Bun runner after its cross-runtime exit-status cleanup was corrected.Full review path applies: this changes a deletion default, cross-version RPC intent and durable removal behavior across more than five production files. It is not eligible for the light path. A reviewed plan and full design-panel settlement precede the compatibility repair. Normal precommit and final CI passed. Source review, the full design-panel settlement and the fresh convergence check are complete; no blocking finding remains. No merge or release is included.