Skip to content

fix(worktree): verify creates with a fresh listing - #16700

Closed
brennanb2025 wants to merge 2 commits into
mainfrom
brennanb2025/sta-5522-windows-worktree-list
Closed

brennanb2025 wants to merge 2 commits into
mainfrom
brennanb2025/sta-5522-windows-worktree-list

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​80 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​78
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

After Git creates a worktree, Orca now verifies it with a fresh Git listing instead of reusing a background listing that may have started before creation.

What Changed

  • use the existing strict, non-shared worktree listing for local post-create verification in both desktop IPC and runtime creation
  • add deterministic Windows and runtime regressions where the shared listing is stale/empty but the fresh listing contains the created worktree

Why

The post-add verification was using the same in-flight-deduplicated, error-softening listing intended for background refreshes. On Windows, verification could therefore receive a pre-create empty result even though git worktree add succeeded and a fresh git worktree list contained the new row.

Linked Issue

Fixes #16520
Linear: STA-5522

Visual Proof

N/A — this changes main-process Git verification only; no UI surface changed.

Testing

  • Automated tests added/updated
  • pnpm exec vitest run src/main/ipc/worktrees-windows.test.ts src/main/ipc/worktrees-local-create-flow.test.ts src/main/git/worktree-scan-cache-sharing.test.ts src/main/git/worktree-list-porcelain.test.ts (43 passed)
  • pnpm exec vitest run src/main/runtime/orca-runtime.test.ts (1,207 passed, 1 existing skip)
  • pnpm tc:node
  • direct oxlint and oxfmt --check on all four changed files
  • git diff --check
  • Real Windows smoke test (not available in this macOS workspace)

pnpm run check:code-quality:changed could not parse its oxlint JSON under this session's Node 26 engine warning; the commit hook and direct oxlint checks both passed.

AI Disclosure

Review

  • Cross-platform: no new path or shell logic; the Windows separator/case regression remains covered, and WSL execution options continue to flow into the strict list.
  • SSH/remote: unchanged; the fix is limited to local creation verification and adds no wire fields or opcodes.
  • Git compatibility: reuses the existing bounded strict-list implementation and its Git 2.25-compatible fallback; no Git command or option was added.
  • Performance: replaces one post-create list with one authoritative non-shared list; no sleeps, retries, polling, or subprocess fanout were added.
  • Security/mobile/providers/UI: no dependency, credential, mobile-facing, provider-specific, or rendered UI surface changed.

Agent skill upstream boundary

  • Not applicable; this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No readiness findings. Electron validation was not applicable because the changed surface does not render UI.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • N/A visual proof is documented
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path impact considered
  • Full lint/typecheck/test/build matrix (CI will cover; focused local checks above passed)

Author

@BrennanKB5

@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 21 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 20879528-dca4-415d-9e72-c00599378c11

📥 Commits

Reviewing files that changed from the base of the PR and between 94e7586 and 10effe5.

📒 Files selected for processing (4)
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees-windows.test.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts

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: df8d883d-8450-4598-9075-6626843ac0b9

📥 Commits

Reviewing files that changed from the base of the PR and between cd5be48 and 7865d22.

📒 Files selected for processing (4)
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees-windows.test.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts

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


📝 Walkthrough

Walkthrough

Worktree creation verification now uses listWorktreesStrict instead of listWorktrees in IPC and runtime paths. Both git-option branches use strict listing after creation. Windows IPC and runtime tests now mock strict listing separately and verify creation when shared listing data is empty.

Merge Risk: ⚪ Minimal · up to 7865d

This localized change makes post-create worktree verification use a fresh listing and adds regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 1 functions across 2 files. (2 skipped: 2 … 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 clearly and concisely describes the main change: verifying created worktrees with a fresh listing.
Description check ✅ Passed The description is complete and follows the repository template. It explains the change, rationale, linked issue, testing, scope, and visual-proof status. The unchecked full validation matrix is also …
Linked Issues check ✅ Passed The changes directly address issue #16520 by replacing stale shared-list verification with fresh strict listings in both local worktree creation paths. Regression tests cover the reported stale-listin…
Out of Scope Changes check ✅ Passed The changes are limited to local worktree verification and related regression tests. They do not introduce unrelated UI, remote, Git command, provider, or dependency changes.
Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the change, rationale, linked issue, testing, scope, and visual-proof status. The unchecked full validation matrix is also explained as CI-covered.

Full details: Linked Issues check

Explanation

The changes directly address issue #16520 by replacing stale shared-list verification with fresh strict listings in both local worktree creation paths. Regression tests cover the reported stale-listing behavior.

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 1 functions across 2 files. (2 skipped: 2 too large.)

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

@brennanb2025 brennanb2025 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head review verification for 7865d223df13c40246a3906c1d5e83603868dd96 (base cd5be48a34031623a8b5d3cc210bd6b048c23052): no in-scope code findings after three adversarial passes.

I traced both changed creation entry points through the strict/shared listing implementations, Git capability cache, Git 2.25 fallback, Windows/WSL path handling, folder-workspace early return, SSH/provider ownership, concurrent create behavior, and error/cleanup semantics. Both post-add paths now use the non-shared strict listing, preserve WSL options and path reconciliation, and propagate listing errors instead of trusting an error-softened empty result; no wire, provider, mobile, persisted-state, or UI contract changed.

Merge readiness is still blocked by the current red CI: Node 24 shard 12 failed in untouched src/main/updater.startup-scheduling.test.ts (three updater calls vs two), and verify failed only because that shard was red. The exact updater test passes locally, so the failure appears unrelated to this PR, but I am not recommending merge until the required checks rerun green.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

QA evidence for exact head 7865d223df13c40246a3906c1d5e83603868dd96:

  • 1,270 focused/relevant tests passed with 1 existing skip across Windows/local/runtime creation, WSL routing, reconciliation, real-Git symlink handling, scan sharing, porcelain parsing, Git capability fallback, and graph listing.
  • An additional WSL/folder/local creation + updater rerun passed 34/34.
  • pnpm tc:node, direct oxlint, direct formatting check, and git diff --check passed.
  • Exact-head CI passed Git compatibility, Windows packaging, typecheck, static analysis, all Node 26 shards, and 15/16 Node 24 shards.
  • pnpm run check:code-quality:changed hit the documented Node 26 harness bug parsing the engine warning as oxlint JSON; the direct code-quality commands passed.

Not run: a real Windows 11 create smoke. No Electron run or screenshots were produced because this PR changes no rendered UI; the remaining blocker is the unrelated red Node 24 shard described in the review comment.

@nwparker

Copy link
Copy Markdown
Contributor

Superseded by #17388, which takes the same first step as this PR (verifying against the
error-propagating listing) and keeps your resetRuntimeTestMocks approach of making the strict mock
delegate to listWorktrees — that part was right and I adopted it.

Closing rather than iterating here, for two reasons worth recording:

The stated cause isn't reachable on main. This PR attributes the bug to verification joining a
stale in-flight scan. addWorktree retires every overlapping scan generation in its finally, and
the generation is part of the shared-scan key, so I couldn't construct that join — and
worktree-scan-cache-sharing.test.ts:188 already guards it. The actual cause is the return []
softening in listWorktreesUnshared, which turns every Git listing failure into an empty list.

It changes the message, not the outcome. With the strict listing alone, a failing listing still
fails the create after git worktree add has succeeded, so the reported impact — every create
leaving an orphaned but valid worktree and branch behind — is unchanged. #17388 adds a direct read of
the worktree (rev-parse / symbolic-ref) so Git can still confirm the create when the listing
can't, which is what actually fixes #16520.

Thanks for finding and pinning down the softened-listing behavior — that was the real defect, and it
would have kept producing opaque "created but not found in listing" reports otherwise.

@nwparker nwparker closed this Aug 30, 2026
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]: worktree.create fails with "Worktree created but not found in listing" although the worktree is actually created

2 participants