Skip to content

fix(app): gate worktree creation to Git projects - #46930

Open
Hona wants to merge 1 commit into
anomalyco:v2from
Hona:worktree-capabilities
Open

fix(app): gate worktree creation to Git projects#46930
Hona wants to merge 1 commit into
anomalyco:v2from
Hona:worktree-capabilities

Conversation

@Hona

@Hona Hona commented Sep 3, 2026

Copy link
Copy Markdown
Member
  • Follow-up to fix(app): show review diffs for non-git VCS backends #46684: require Git project metadata before offering Git-backed worktree creation.
  • Hide the non-Git move suggestion and disable New worktree in the session menu. Do not infer Git support from a branch name in the new-session picker.
  • Preserve non-Git diffs, branch labels, and moves to existing directories.
Mercurial Before After
Desktop Git-only actions offered for Mercurial Creation disabled while existing destinations remain available
Mobile Unsupported worktree suggestion Diff summary without the unsupported suggestion
Cold session entry, median Before (upstream/v2) After
First correct content 712.9 ms 498.0 ms
Stable content 737.5 ms 524.1 ms
  • Three serial Chromium runs per production build on Windows. Small-sample comparison, not a speedup claim.

Copilot AI lite review requested due to automatic review settings September 3, 2026 00:24
@Hona
Hona requested a review from Brendonovich as a code owner September 3, 2026 00:24

Copilot AI 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.

🟡 Changes recommended

The new E2E spec uses an invalid toBeEnabled({ enabled: ... }) matcher option, which will fail type-checking and/or test execution.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR tightens Git-only UX around worktree creation by requiring explicit Git project metadata before enabling “New worktree” flows, while keeping non-Git review diffs and existing-directory moves functional.

Changes:

  • Gate worktree creation UI/actions on project.vcs === "git" (session menu + summary suggestion).
  • Stop inferring Git capability from branch presence when deciding whether to expose new-session worktree controls.
  • Add/adjust regression coverage for Git vs non-Git behavior across desktop/mobile.
File summaries
File Description
packages/app/src/session/timeline/session-workspace-menu.tsx Disables “New worktree” menu item unless the project is Git.
packages/app/src/session/timeline/message-timeline.tsx Hides the “Move to worktree” suggestion unless the project is Git.
packages/app/src/new-session/workspace/controller.ts Requires projectVcs === "git" to treat the project as Git-capable (removes branch-based inference).
packages/app/src/new-session/workspace/controller.test.ts Updates unit tests to reflect stricter Git detection and new worktree selection fallback handling.
packages/app/src/new-session/view.tsx Preserves branch label display for non-Git projects while keeping Git-only actions gated elsewhere.
packages/app/e2e/regression/session-worktree-capabilities.spec.ts Adds E2E coverage to ensure creation is gated but existing moves remain available (contains a matcher misuse noted in review comments).
packages/app/e2e/regression/new-session-workspace-branch.spec.ts Extends E2E coverage to confirm non-Git projects don’t show the worktree-selection UI even if branches exist.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +62 to +65
const create = page.getByRole("menuitem", { name: "New worktree", exact: true })
await expect(create).toBeVisible()
await expect.soft(create).toBeEnabled({ enabled: vcs === "git" })
await info.attach("destinations", {
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.

2 participants