Skip to content

fix(floating-workspace): persist Markdown tab renames - #11398

Merged
OrcaWin merged 7 commits into
stablyai:mainfrom
dbachko:dbachko/fix-floating-workspace-node
Jul 30, 2026
Merged

OrcaWin merged 7 commits into
stablyai:mainfrom
dbachko:dbachko/fix-floating-workspace-node

Conversation

@dbachko

@dbachko dbachko commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix Floating Workspace Markdown renames so Enter or blur persists the new tab label, open editor state, and on-disk filename.
  • Treat Orca's synthetic Floating Workspace as an explicit local file-operation owner while preserving the existing generation guard for rename, undo, and redo.
  • Add ownership and Electron regressions for the user-visible rename flow.

Fixes #11397.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — the full suite was not run; the focused ownership suite passed with 7 tests.
  • pnpm build — the full build was not run; Electron E2E setup rebuilt the app and bundled CLI successfully.
  • Added or updated high-quality tests that would catch regressions.

Additional verification:

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/file-explorer-operation-generation.test.ts
  • SKIP_BUILD=1 npx playwright test tests/e2e/floating-tab-rename.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1
  • pnpm run check:code-quality:changed
  • pnpm run check:max-lines-ratchet

AI Review Report

The review traced the renderer rejection through captureFileExplorerOperationGuard and identified the missing local owner for global-floating-terminal. It checked neighboring local, SSH, runtime, and folder-workspace routes and verified that only the synthetic Floating Workspace path changes.

Cross-platform review covered macOS, Linux, and Windows, including shortcuts, labels, paths, shell behavior, and Electron-specific differences. The production change adds none of those platform-dependent behaviors. The E2E setup chooses the runtime path separator.

SSH/remote/local compatibility remains intact because normal worktree and folder-workspace routing is unchanged. Agent, integration, and Git-provider behavior is unaffected. Performance risk is negligible: ownership resolution adds one constant-time ID comparison. UI review found no visual change.

Security Audit

The review covered filename input, path handling, command execution, authentication, secrets, dependencies, and IPC. Existing rename validation, path construction, IPC authorization, and operation-generation guards remain in place. Floating Workspace Markdown storage is app-owned or explicitly user-authorized.

The change adds no commands, credentials, dependencies, IPC surface, or authorization bypass. No security follow-up is required.

Notes

@dbachko
dbachko marked this pull request as ready for review July 29, 2026 19:56
Comment thread tests/e2e/floating-tab-rename.spec.ts Resolved
@greptile-apps

greptile-apps Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR fixes Floating Workspace Markdown tab renames by (1) returning { kind: 'local' } for the synthetic FLOATING_TERMINAL_WORKTREE_ID in the operation-owner resolver, which previously fell through to 'unresolved' and caused the renderer to reject rename operations, and (2) replacing the inline assertNoClobberRenameDestinationAvailable + rename pair in both the IPC and runtime rename paths with a new renameLocalPathSerializedByDestination helper that serializes concurrent renames within the same destination directory.

  • Owner fix (file-explorer-operation-owner.ts): adds an early-return guard for FLOATING_TERMINAL_WORKTREE_ID before the workspace-key parsing logic, so the floating workspace always resolves to the local execution host.
  • Serialized rename (destination-serialized-local-rename.ts): introduces a per-destination-parent promise chain so that two concurrent renames to Unicode-aliased filenames in the same directory are serialized, preventing a TOCTOU race on case-insensitive filesystems.
  • isSameDirectoryEntryRename (filesystem-rename-collision.ts): upgrades same-entry detection from a pure basename case-fold check to a realpath-based identity check, with a case-fold fallback for dangling symlinks.

Confidence Score: 5/5

Safe to merge; the change is narrowly scoped to the floating workspace rename path and shared serialization helper, leaving SSH, runtime, and folder-workspace paths untouched.

The root-cause fix is a single constant comparison with no side-effects on other workspace types. The serialization queue is race-free within the JavaScript event loop. Queue cleanup is correct for all chain depths. The upgraded isSameDirectoryEntryRename uses realpath identity before falling back to case-fold and fails closed on non-ENOENT errors. Tests cover Unicode aliases, concurrent clobber prevention, error recovery, symlink-parent keying, and the full persist-across-restart E2E flow.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
src/main/destination-serialized-local-rename.ts New module implementing per-parent-directory serialized rename; queue logic is correct and handles concurrent callers, errors, and cleanup without races or memory leaks.
src/shared/filesystem-rename-collision.ts Replaces case-fold-only same-entry detection with realpath-based identity check; correctly falls back to case-fold for dangling symlinks and fails closed on non-ENOENT realpath errors.
src/renderer/src/components/right-sidebar/file-explorer-operation-owner.ts Adds early-return for FLOATING_TERMINAL_WORKTREE_ID before workspace-key parsing, resolving the root cause of the rename regression; existing SSH/runtime/folder-workspace paths are unaffected.
src/main/ipc/filesystem-mutations.ts Delegates local rename to renameLocalPathSerializedByDestination; SSH rename path is unchanged; path authorization still runs before the serialized call.
src/main/runtime/orca-runtime-files.ts Same delegate pattern as IPC mutations; SSH branch is unaffected; local rename now uses shared serialized helper.
tests/e2e/floating-tab-rename.spec.ts E2E tests covering concurrent clobber prevention, Unicode alias serialization (macOS-only), and full persist-across-restart flow via two Electron launches.

Reviews (3): Last reviewed commit: "fix(filesystem): canonicalize rename par..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Floating worktree file explorer operations now resolve to the local host through a dedicated ownership path. Local rename operations now use destination-parent serialization with canonical path handling across IPC and runtime entry points. Tests cover floating tab renaming, concurrent renames, Unicode and symlinked parent paths, case-only renames, and permission failures.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: persisting Markdown tab renames in Floating Workspace.
Description check ✅ Passed The description covers summary, screenshots, testing, AI review, security audit, and notes, including the required cross-platform review.
Linked Issues check ✅ Passed The code and tests directly address #11397 by routing floating worktree operations locally and verifying the tab, editor state, and file rename flow.
Out of Scope Changes check ✅ Passed The changes stay focused on the floating-workspace rename fix and related regression coverage without obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@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)
tests/e2e/floating-tab-rename.spec.ts (1)

20-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Build the temporary file path with path.join.

The separator heuristic is incorrect for valid POSIX directory names containing \. Retrieve the directory in the page context, join it with node:path in the Playwright process, then pass filePath into page.evaluate. As per coding guidelines, use path utilities such as path.join instead of hardcoded separators.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 45c888c5-a7fb-40e6-ad9f-2e56b65c5e90

📥 Commits

Reviewing files that changed from the base of the PR and between 363e478 and 182e221d75e2a600668d755fc9b2a46da044cf90.

📒 Files selected for processing (3)
  • src/renderer/src/components/right-sidebar/file-explorer-operation-generation.test.ts
  • src/renderer/src/components/right-sidebar/file-explorer-operation-owner.ts
  • tests/e2e/floating-tab-rename.spec.ts

Comment thread tests/e2e/floating-tab-rename.spec.ts Resolved
@Jinwoo-H
Jinwoo-H force-pushed the dbachko/fix-floating-workspace-node branch from ba6d27e to 498781f Compare July 30, 2026 03:43

@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.

🧹 Nitpick comments (1)
src/main/destination-serialized-local-rename.ts (1)

8-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Import the shared isENOENT guard.

This file already imports from the rename-collision module, and src/main/ipc/filesystem-auth.ts exports the same isENOENT guard used across filesystem code. Reusing that export here avoids another local duplicate.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e9e262cb-e27c-42b6-9918-e448a587a77c

📥 Commits

Reviewing files that changed from the base of the PR and between ba6d27e99e9856ac29777406a4fbd04ff5f660fd and 498781f.

📒 Files selected for processing (5)
  • src/main/destination-serialized-local-rename.test.ts
  • src/main/destination-serialized-local-rename.ts
  • src/main/ipc/filesystem-mutations.test.ts
  • src/main/ipc/filesystem-mutations.ts
  • src/main/runtime/orca-runtime-files.ts

@OrcaWin
OrcaWin merged commit 561e2d3 into stablyai:main Jul 30, 2026
144 of 154 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(floating-workspace): route markdown renames locally

* test(floating-workspace): strengthen rename regression

* test(floating-workspace): verify rename restart persistence

* fix(filesystem): serialize local rename destinations

* fix(filesystem): serialize Unicode rename aliases

* fix(filesystem): align rename locks with native aliases

* fix(filesystem): canonicalize rename parent locks

---------

Co-authored-by: Dzmitry Bachko <[email protected]>
Co-authored-by: OrcaWin <[email protected]>
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.

[Bug]: Floating workspace Markdown rename reverts instead of renaming the file

2 participants