Skip to content

Fix Windows workspace deletion runtime resolution - #5888

Merged
AmethystLiang merged 2 commits into
mainfrom
bug-delete-workspace-fails-on-trying-to-delete
Jun 20, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
bug-delete-workspace-fails-on-trying-to-delete

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Issue: [Bug]: Delete Workspace Fails on Trying to Delete - For Certain Windows Project Config #5864
  • Use strict delete-time worktree listing while threading the selected project runtime option through workspace deletion.
  • Resolve the runtime selector before deletion so project-created Windows workspaces do not falsely report "Refusing to delete unregistered worktree path".
  • Track knownRemovedWorktree for the expected removal path and extend coverage across Windows path spelling, runtime selection, delete guards, and related integration tests.

Design Doc

  • docs/delete-workspace-windows-unregistered.md

Validation

  • Electron validation passed in a dev app launched from this worktree.
  • STYLEGUIDE_UI_CHECK: pass.
  • Scenarios validated: app load, delete confirmation, sidebar after delete, adjacent sidebar behavior.
  • Local review screenshots are in validation-screenshots/ and are intentionally uncommitted.

Residual Risk

  • macOS Electron validation plus unit coverage for Windows path spelling passed; real Windows filesystem/Git behavior remains platform-specific.

AmethystLiang and others added 2 commits June 20, 2026 00:17
Co-authored-by: Orca <help@stably.ai>
Resolve project-created workspace deletion through the selected project runtime so Windows paths are listed strictly without falsely tripping the unregistered worktree guard.

Design doc: docs/delete-workspace-windows-unregistered.md
@ghost

ghost commented Jun 20, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 7 individual chapters for you:

Title
1 Document Windows workspace deletion fix design
2 Introduce strict worktree listing utility
3 Update IPC handlers for strict deletion
4 Refine runtime service deletion logic
5 Update tests for strict listing and Windows
6 Update rate-limit expiration translations
7 Other changes
Open in Stage

Chapters generated by Stage for commit b6c67e8 on Jun 20, 2026 8:04am UTC.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new listWorktreesStrict function is added to worktree.ts that lets Git listing errors propagate to callers instead of being silently swallowed as empty results. This function is imported and used in orca-runtime.ts and worktrees.ts during worktree removal. Both files are updated to thread localWorktreeGitOptions consistently through the full removal pipeline—registered-worktree lookups, archive-hook execution, and git worktree prune cleanup—and removeWorktree calls now always include a knownRemovedWorktree field. Tests across multiple files are updated to reflect the new call signatures and add Windows path normalization and WSL strict-listing failure coverage. Five locale files receive new rate-limit reset expiration timing strings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main focus of the PR: fixing a Windows-specific workspace deletion issue by improving runtime resolution during the deletion process.
Description check ✅ Passed The description is clearly related to the changeset, covering the issue being fixed, the design approach, validation performed, and residual risks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

Tools execution failed with the following error:

Failed to run tools: 8 RESOURCE_EXHAUSTED: Received message larger than max (322118034 vs 209715200)


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)

13931-13935: ⚡ Quick win

Add a short “why” comment for the strict local listing branch.

This runtime-specific strict listing is the key Windows/WSL path-spelling invariant; make that explicit so it is not “simplified” back to runtime-agnostic listing later.

Proposed comment
+      // Why: delete-time validation must list through the selected local runtime so
+      // Windows/WSL path spelling matches the canonical worktree row used by the guard.
       const registeredWorktrees = repo.connectionId
         ? await provider!.listWorktrees(repo.path)
         : hasLocalWorktreeGitOptions
           ? await listWorktreesStrict(repo.path, localWorktreeGitOptions)
           : await listWorktreesStrict(repo.path)

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d4b83f2d-8443-4d06-94cc-9ce66c14f919

📥 Commits

Reviewing files that changed from the base of the PR and between 04004bf and b6c67e8.

📒 Files selected for processing (19)
  • docs/delete-workspace-windows-unregistered.md
  • src/main/browser/cdp-bridge-integration.test.ts
  • src/main/git/worktree.ts
  • src/main/ipc/filesystem.test.ts
  • src/main/ipc/worktrees-windows.test.ts
  • src/main/ipc/worktrees.test.ts
  • src/main/ipc/worktrees.ts
  • src/main/runtime/fit-override-integration.test.ts
  • src/main/runtime/mobile-presence-lock.test.ts
  • src/main/runtime/mobile-subscribe-integration.test.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/runtime-rpc.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • test test.txt

Comment thread src/main/git/worktree.ts
Comment on lines +495 to +504
export async function listWorktreesStrict(
repoPath: string,
options: GitWorktreeExecOptions = {}
): Promise<GitWorktreeInfo[]> {
const worktrees = (await readWorktreeList(repoPath, options)).map((worktree) => {
const translatedPath = translateWorktreePath(worktree.path, repoPath, options)
return translatedPath === worktree.path ? worktree : { ...worktree, path: translatedPath }
})
return annotateSparseCheckoutStatus(worktrees)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a short “Why” comment for strict error propagation (Line 495).

listWorktreesStrict is design-driven and intentionally differs from listWorktrees by surfacing failures; please add a 1–2 line comment stating that reason so future changes don’t reintroduce silent fallback behavior.

Source: Coding guidelines

@AmethystLiang
AmethystLiang merged commit 553d47b into main Jun 20, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Add test file for workspace delete bug

Co-authored-by: Orca <help@stably.ai>

* Fix Windows workspace deletion runtime resolution

Resolve project-created workspace deletion through the selected project runtime so Windows paths are listed strictly without falsely tripping the unregistered worktree guard.

Design doc: docs/delete-workspace-windows-unregistered.md

---------

Co-authored-by: Orca <help@stably.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant