Repository navigation
fix(projects): a manual folder-to-Git change proves the folder is the Git root first - #29282
Conversation
…der workspaces (STA-10638) A folder project's extra workspaces exist only as metadata rows that the folder listing shows. Changing the project to Git switches it to `git worktree list`, so those workspaces drop out of the next refresh and their saved tabs are purged as if they had been deleted. Only the automatic upgrade checked for this; `orca project setup-update --kind git`, repo updates and clone-into-folder did not. The check now lives in the one repo write every type change goes through, so any caller gets the same refusal and nothing is written. The automatic upgrade and both clone paths use the same check and keep the project as a folder project.
…lone path now uses
… Git root first (STA-10638) Only the automatic upgrade checked that a folder project's path is the top of a Git repository and recorded Git's spelling of that root. A manual change (orca project setup-update --kind git, repo updates, clone into a folder project) flipped the type without either, so a project inside another repo became a broken Git project, and a project whose path Git spells differently lost its main workspace's id and tabs on the next refresh. All of them now run the same proof and write the proven root with the type change. SSH projects keep the unverified change because their Git runs on a host this process can't probe.
|
A folder project could be changed to Git while pointing inside another repository, leaving a project whose workspace list failed. A project reached through a symlinked parent could also lose its main workspace tabs after refresh because manual conversion did not record how Git spells the root. This PR checks that the selected folder is the Git root before changing its type, then records that spelling to preserve the main workspace identity and tabs. A refusal writes none of the requested changes. If the project changes during the check, Orca says: “The project changed while Orca was checking it, so its type was not changed. Try again.” Source review and required remote Electron comparison passed on the current head. Reviewed PR C's original top commit and review fixes only, excluding its base #29257 and separate #29265. Current head: Fixed during review:
Deferred concerns: pre-existing setup-ID routing ambiguity, two synchronous setup writes without an identified intermediate observer, and unmeasured synchronous filesystem latency on WSL paths. No demonstrated new user failure was established for these concerns. SSH's unchecked conversion remains temporary until a compatible host-side root query is added. The pending product option to keep folder workspaces listed in Git projects is excluded. Production additions remain 246 code lines excluding blanks/comments (285 raw); no further production growth was made. Verification: Windows passed 89 tests across four named files at Remote Electron QA passed on M4Air, comparing pinned main
Limits: setup scripts and default tabs on newly created worktrees were not exercised. Existing-folder activation showed Terminal 1 despite the fixture's For Brennan's review The screenshots show both required flows together:
Immediately after the CLI, before reload: main, branch. Both still show the original alias tabs at that point.
Update after #29257 merged: this PR now targets main. Main was merged in and its lockfile restored ( |
# Conflicts: # src/main/ipc/repos/repo-clone-lifecycle.ts # src/main/persistence-update-repo.test.ts # src/main/runtime/runtime-repository-clone-controller.ts
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
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:
36a74592-ce4e-437e-96c0-b1e0a89ac4a5
⛔ Files ignored due to path filters: 1
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing: 14
src/main/folder-repo-git-conversion.tssrc/main/ipc/folder-repo-git-upgrade.tssrc/main/ipc/repos-local-add-and-project-setup.test.tssrc/main/ipc/repos-local-clone-lifecycle.test.tssrc/main/ipc/repos/project-host-setup-handlers.tssrc/main/ipc/repos/repo-clone-lifecycle.tssrc/main/ipc/repos/repo-update-handler.tssrc/main/persistence-update-repo.test.tssrc/main/runtime/orca-runtime-tests/repository-project-operations-part-02.spec.tssrc/main/runtime/rpc/methods/project-runtime-rpc-methods.tssrc/main/runtime/runtime-project-host-setup-controller.tssrc/main/runtime/runtime-project-host-setup-publication.test.tssrc/main/runtime/runtime-repository-clone-controller.tssrc/main/runtime/runtime-repository-settings-controller.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.




ELI5
Before Orca turns a folder project into a Git project, it now checks that the folder really is the top of a Git repository. If it isn't, the change is refused and nothing is written. Until now only the automatic upgrade did this check; changing the type by hand skipped it.
Stacked on #29257 (refuse a folder-to-Git change that would hide folder workspaces). This review covers PR C’s original top commit and its review fixes; PR A and #29265 are separate.
What Changed
The problem. A folder project can become a Git project in two ways. One is automatic: Orca notices a
git init. The other is manual:orca project setup-update --kind git, a general repo update, or cloning into an existing folder project. The automatic path does two things first:The manual paths did neither, so they could break a project, or lose the main workspace's tabs, in the same way the user in #29257 lost their other workspaces.
The change. The automatic upgrade's check moved into one shared function, and every manual folder-to-Git change now runs it first:
setup-update, on the desktop and on a paired serverIf the folder isn't the top of a Git repository, the change is refused with " isn't the top folder of a Git repository, so this project's type was not changed." Otherwise the recorded root is written with the type change. If the project is removed, moved or already converted while Git is being checked, Orca writes none of the requested changes and says: “The project changed while Orca was checking it, so its type was not changed. Try again.” Clone completion also rereads the current project and folder-workspace metadata after that check.
Intended difference: the automatic upgrade also hides external worktrees when the spelling matches. That stays a choice of the automatic upgrade only, so a manual change keeps the user's own visibility setting.
What you see. Before:
setup-update --kind giton a folder inside another repo succeeds and leaves a project whose workspace list fails. On a symlinked folder, the main workspace's tabs disappear after the next refresh. After: the first is refused with the message above, and the second keeps its main workspace and tabs.Why
Two entry points each made their own copy of one decision, and only one copy was complete. This is the second time that has happened in this mechanism (#20653 added the recorded root to the automatic path only), so the fix is one shared function used by every path, not a third copy.
Where the check runs: on the machine that runs Git for the project. That covers local projects, projects behind a WSL path (Git runs through the existing WSL route), and projects registered on a paired server (checked on that server). Temporary difference: projects on an SSH host keep today's unchecked change, because the SSH connection has no "find the Git root" call yet. Adding one is a wire change for a follow-up.
Linked Issue
Linear STA-10638
Visual Proof
Remote Electron comparison passed on M4Air using signed-in Grok and the approved paired-terminal Playwright CDP route. Pinned main
a54236751ec132f0c816eb9a6b598bbc6b22b0ebaccepted the nested-folder request and hid its workspace after reload; this head refused and kept the original folder type and name. Main's symlink-parent root lost its visible workspace and tabs after reload (saved tab records remained under the old identity); this head retained the exact workspace ID, Editor/Logs tab IDs, order and active Logs selection. Ordinary-root conversion also retained its workspace and tab.Before conversion: main, branch. Full QA and review evidence.
Limits: new-worktree setup scripts/default tabs and rendered SSH/WSL execution were not exercised. The existing-folder fixture opened Terminal 1; its config is for new worktree creation. Selected Logs survived reload; keyboard focus did not persist. No conversion regression was established for those observations.
Testing
git init: a folder project inside the repo (not at its top) is refused and stays a folder project; the project at the top converts and records the root.1c16fff5baf1d5a6a20d7fd1cdcb3a213678eb3d. Its only change after those passing runs replaces an unchecked property access in a test assertion, fixing CI's TS18046. That assertion-only change has not been rerun remotely.Review
Two adversarial review rounds, an architecture challenge, a performance review and final source readiness review completed. Two bounded design panels retained the focused root-proof design and required current-state checks at mutation. Review fixes cover SSH host ownership, stale projects and WSL move protection after the asynchronous check, clone registration changes, and ordinary settings updates avoiding unnecessary catalog reads. Runtime clone test fixtures now create an actual temporary Git root.
Deferred concerns, with no demonstrated new user failure: pre-existing setup-ID routing ambiguity, two synchronous setup writes with no identified intermediate observer, and unmeasured filesystem latency on WSL network paths. The required rendered main-versus-branch comparison and full exact-head PR workflow passed. Review status. The product option to keep folder workspaces listed in Git projects is excluded.
Agent skill upstream boundary
Notes
No new saved field, and no change to what the IPC or RPC messages carry.
repos:update,projectHostSetups:updateand the runtimeprojectHostSetup.updatenow resolve asynchronously; their callers already await them. The write-protection check during a WSL move refuses before any Git probe starts and is repeated immediately before mutation after the probe.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — full exact-head PR workflow passed; remote QA build passedAuthor: @BrennanKB5