Skip to content

perf: overlap independent worktree create preflight - #17386

Merged
nwparker merged 3 commits into
mainfrom
nwparker/worktree-create-preflight
Aug 30, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/worktree-create-preflight

Conversation

@nwparker

@nwparker nwparker commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​49 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​49
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51 $\color{#cf222e}{\Huge{\mathbf{−}}}$​59 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8

Summary

  • Resolve the branch-prefix username and worktree base plan concurrently for local, runtime, and SSH worktree creation.
  • Overlap independent remote-tracking/local-base presence probes while preserving fallback and mutation ordering.
  • Resolve orca.yaml shared directories and .worktreeinclude entries concurrently after the worktree exists; shared-path mutations still finish before include copies.

This is a small, read-only preflight optimization extracted from the broader early-terminal work in #13704. It does not change IPC/RPC payloads, checkout semantics, cleanup, or terminal startup.

Correctness / risk

  • No new Git commands; only independent existing probes overlap.
  • Branch conflict/suffix loops and all mutations remain ordered.
  • SSH/WSL options are passed unchanged and remote execution remains host-owned.
  • Folder workspaces continue to bypass Git worktree creation.

Evidence

  • Added a deterministic test proving username and base probes start before either completes.
  • Focused worktree-create suites: 33 passed.
  • Runtime worktree tests and typecheck passed before commit; changed-code quality was previously green on the same diff. The current checkout's pnpm wrapper is blocked by the repository's minimum-release-age check for an unrelated [email protected] lockfile entry.

Follow-up context

@nwparker

Copy link
Copy Markdown
Contributor Author

Validation update:

  • Local create flow + preparation/filesystem suites: 33 focused tests passed.
  • Runtime SSH/WSL/base-ref suites: 23 tests passed.
  • Direct typecheck, oxlint, oxfmt, and git diff --check pass.
  • CI jobs currently stop during dependency installation at the repository minimum-release-age policy for unrelated [email protected]; no changed code reaches those jobs yet.

The optimization intentionally leaves the runtime PR/branch review probe behavior unchanged; only existing read-only probes are overlapped, and all mutations retain their prior order.

@nwparker

Copy link
Copy Markdown
Contributor Author

Follow-up commit 0e9d1fe8c7f keeps the promise setup explicit (usernamePromise + baseBranchPromise) before the Promise.all, so the overlap is easy to audit and the mutation order is unchanged.

Additional focused run: 40 tests passed across local create and SSH/WSL base-ref/suffixing suites; direct typecheck, oxlint, oxfmt, and diff checks pass.

@nwparker
nwparker marked this pull request as ready for review August 30, 2026 10:29
@nwparker

Copy link
Copy Markdown
Contributor Author

Readiness check (2026-08-30):

  • Marked Ready for review.
  • Scope remains limited to overlapping independent read-only preflight work: username/base resolution, base-ref presence probes, and post-create metadata discovery. Mutation order and create semantics are unchanged.
  • CI is fully green: typecheck, static analysis, Linux/Windows packaging, all 8 Node 24 test shards, verify, and repository guards.
  • Local validation: focused create/preparation/filesystem + SSH/WSL/base-ref suites passed; direct typecheck, oxlint, oxfmt, and diff checks passed.
  • No mobile-facing protocol/RPC schema changes; folder workspaces, SSH, WSL, and provider-neutral paths remain covered by existing routing and tests.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 08e3d2fa-f2eb-44d3-a149-27445e2f2a97

📥 Commits

Reviewing files that changed from the base of the PR and between 7f822a7 and cc37991.

📒 Files selected for processing (3)
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees-local-create-flow.test.ts
  • src/main/runtime/orca-runtime.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Independent read-only probes in remote and local worktree creation now start concurrently through Promise.all. The probes cover usernames, base plans, ref presence, shared directories, and include paths. Existing branching, error handling, and follow-up copy operations remain unchanged. A test verifies concurrent startup of local username and default base-ref resolution and confirms branch creation uses the resolved username.

Merge Risk: ⚪ Minimal · up to cc379

This PR overlaps independent preflight work while preserving existing mutation ordering and behavior; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation, scope, risks, and evidence clearly, but it omits most required template sections. It does not provide the required linked issue, completed testing checklis… Complete the repository template. Add the required Linked Issue entry, state N/A with a reason for Visual Proof, document testing platforms and mark the applicable Testing checkboxes, complete AI Disclosure if applicable, add Review and Not…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: overlapping independent worktree creation preflight operations for performance.
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.
Full details: Description check

Explanation

The description explains the implementation, scope, risks, and evidence clearly, but it omits most required template sections. It does not provide the required linked issue, completed testing checklist, visual-proof statement, AI disclosure, review notes, agent-skill boundary checkbox, notes, or final checklist.

Resolution

Complete the repository template. Add the required Linked Issue entry, state N/A with a reason for Visual Proof, document testing platforms and mark the applicable Testing checkboxes, complete AI Disclosure if applicable, add Review and Notes content, mark the Agent skill upstream boundary option, and complete the Checklist items.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 too large.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR reduces worktree-creation latency by overlapping independent, read-only preflight and post-creation discovery operations while preserving mutation order.

  • Resolves username and base-ref information concurrently across local, runtime, and SSH creation paths.
  • Runs remote-tracking and local-base presence checks concurrently.
  • Resolves shared-directory and .worktreeinclude configuration concurrently before applying shared paths and copying included files.
  • Adds a deterministic local-flow test proving both preflight probes begin before either completes.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/main/ipc/worktree-remote.ts Overlaps independent local and SSH preflight probes and post-creation path discovery while retaining fallback and mutation sequencing.
src/main/runtime/orca-runtime.ts Applies the same concurrent preflight and path-discovery organization to runtime-owned worktree creation.
src/main/ipc/worktrees-local-create-flow.test.ts Adds deterministic coverage showing username and default-base probes start concurrently.

Sequence Diagram

sequenceDiagram
  participant C as Worktree create flow
  participant U as Username probe
  participant B as Base-plan probe
  participant G as Git worktree creation
  participant S as Shared-directory discovery
  participant I as Worktree-include discovery
  C->>U: Start
  C->>B: Start
  par Independent preflight
    U-->>C: Username
  and
    B-->>C: Base plan
  end
  C->>G: Create worktree
  G-->>C: Created checkout
  par Independent discovery
    C->>S: Resolve shared paths
    S-->>C: Shared directories
  and
    C->>I: Resolve include paths
    I-->>C: Include entries
  end
  C->>C: Create shared paths
  C->>C: Copy remaining include entries
Loading

Reviews (2): Last reviewed commit: "test: prove preflight probes start concu..." | Re-trigger Greptile

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

ℹ️ No critical issues — the overlap itself is sound, but the new test doesn't actually verify concurrency (see inline).

Reviewed changes

  • Overlapped SSH preflight — createRemoteWorktree now resolves the branch-prefix username and the base plan, and later the remote-tracking/local-base presence probes, concurrently via Promise.all.
  • Overlapped local preflight — createLocalWorktree overlaps username + base resolution, the remote-tracking/local-base presence checks, and shared-directory + .worktreeinclude discovery.
  • Overlapped runtime-service preflight — OrcaRuntimeService.createWorktree applies the same overlaps.
  • New concurrency test — a deterministic test in worktrees-local-create-flow.test.ts intended to prove the username and base probes start before either completes.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

  • Concurrency test now actually verifies overlap — the username-start / base-start events are recorded inside the mocks' mockImplementation callbacks instead of the promise executors, so a sequential implementation would leave events as ['username-start'] and fail the assertion at line 152.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit ac02232 into main Aug 30, 2026
32 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Readiness checklist passed; required CI and review checks are green.
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