Repository navigation
fix(worktrees): remove verified partial checkouts after timeout - #1026
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 19, 2026 12:32
nixuuu
enabled auto-merge (squash)
November 19, 2026 12:32
nixuuu
disabled auto-merge
November 19, 2026 12:33
nixuuu
marked this pull request as draft
November 19, 2026 12:33
nixuuu
marked this pull request as ready for review
November 19, 2026 12:34
nixuuu
enabled auto-merge (squash)
November 19, 2026 12:34
This was referenced Nov 19, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 21, 2026
## Changes - Allow 240 seconds for `git worktree add` after Git starts. The report showed 22,067 of 56,756 files written when the 60-second limit expired on Windows. At that rate, checkout would take roughly 154 seconds. Four minutes leaves room for variations in file sizes and write speed. - Give the worker up to 35 seconds to start checkout, including repository and process queues and the optional fetch. Reserve 40 seconds for termination, verification, rollback and delivery within the 315-second gateway wait. Use the same worker path for creation, continuation and `spawn_thread`. Mixed-version gateway and worker pairs retain the 60-second checkout and 90-second gateway wait. - Align web/desktop, native mobile, draft delivery and linked gateway deadlines for creation that may need checkout. The Claude agent bus has a 330-second deadline. ## Verification - Verified PR head `fa8819fa` on nix-pc (Linux, Git 2.56.0, Bun 1.4.5). The 92-second checkout completed via gRPC and started a usable thread. The same test verified that an expired queued request returned promptly and created no branch. The worktree and `spawn_thread` integration suites also covered normal checkout and cleanup after a real process timeout. - Ran the production checkout path with a blocked Git hook. The old and new timers stopped Git after 60.71 and 240.21 seconds. Both runs removed the checkout, Git registration and branch. Targeted `check:tmp` covered 58 cases with no temp leaks. An existing continuation test reached its 5-second test harness limit under load and passed in the isolated continuation run with a 20-second harness limit. Gateway, worker, web and mobile typechecks, edited-file lint, and diff checks passed. - The native mobile integration tests passed on nix-pc. They exercised the app’s creation stream, unary fallback, and draft recovery over Connect through a real gateway and worker. The device tool could not establish ownership of the Android runtime, so no in-app device test was possible. - The Windows CI job runs a slow Git checkout, verifies it unlocks, and tests cleanup using real Git for Windows worktree metadata and a staged incomplete checkout. A live timeout of a Windows process tree and a reproduction on the reported Windows 11 repository are unverified. - Copy audit (§8). The preparation deadline adds a short reason and retry action. The checkout timeout keeps its existing wording. Both messages contain no paths or variable labels. Thanks to @janek-normalnie for reproducing the timeout and sharing the file counts and Git version. Related: #915, #1026
nixuuu
added a commit
that referenced
this pull request
Nov 21, 2026
## What changed - Settings → Worktrees offers **Clean up…** for locked checkouts from a verified failed Canopy setup. The confirmation identifies the folder and explains that cleanup removes the worktree directory and its Git registration while keeping the local branch. - The worker records proof after the checkout process tree has stopped and automatic rollback has left an incomplete checkout. It verifies the original directory identities, registration, branch and contents again before deleting. A matching Git backlink is accepted, and the reported state without a backlink or index and with an empty `index.lock` is covered. Older entries without proof show why cleanup is unavailable. - Cleanup checks for saved worktrees, workspace paths and active threads, and rejects stale confirmations or worker connections. The worker verifies both directories again after moving them aside and reports where any retained files can be found. The checkout timeout behavior and copy on `dev` are preserved. Thanks @janek-normalnie for reporting the incomplete checkout and suggesting a manual cleanup action. ## Verification - On nix-pc (Linux, Git 2.56.0, Bun 1.4.5), 88 focused tests passed on `ed80fec8` through `check:tmp`, with no leftover temporary fixtures. They cover successful and failed checkout creation, the existing rollback, refusal for foreign or changed data, branch and metadata races, concurrent confirmations, owner and workspace scope, link replacement and expiry, and ordinary worktree lifecycle. A real Git checkout also timed out with its backlink present and was cleaned after a transient error prevented automatic rollback. A separate Linux fixture cleaned 22,000 remaining CRLF files from a 55,000-path repo with the Git backlink and index absent. - Worker, gateway and integration-test typechecks passed on the final revision. Web and mobile typechecks passed on the unchanged UI implementation. Editing-scope lint, format and diff checks passed. Protobuf outputs were regenerated after updating the branch from `dev`. - Chromium exercised eligible and ineligible rows, cancel, stale confirmation, server refusal and successful refresh at 1440 and 390 px in light and dark themes. On the native Android 16 development client, verified Settings → Worktrees, the cleanup confirmation, a specific server refusal and refresh after a successful cleanup response. Both UI checks used isolated response fixtures. The gateway–worker tests used a real repository. - CI runs the checkout and cleanup regression with native Git on the Windows Server runner. Jan’s Windows 11 device and original repository were unavailable. - Copy audit (§8). The eligible row now reads “Canopy setup failed · Locked worktree”. “Clean up…” and “Clean up worktree” use the same verb. The confirmation describes the consequences, and a refusal shows its reason beside the refresh action. Checked short, typical and long names at desktop and phone widths. Related: #1026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
index.lockand no index or checkout.git. Require confirmation that termination completed before rollback on a timeout. Check the remaining files against Git blobs without invoking repository filters.Verification
b0098b9eon nix-pc (Linux, Git 2.56.0, Bun 1.4.4).check:tmppassed 37 tests across checkout failures, process termination, folder allocation, thread creation progress and worktree automation. There were no remaining temporary fixtures. Affected package typechecks, edited-file lint andgit diff --checkpassed. The local test run allowed 20 s per test after an earlier combined automation run exceeded its 5 s test budget.54e04f85with Git 2.56.1.windows.1 (6 passed, 4 POSIX-only cases skipped). Native Git creates the registration and the fixture then models the reported stopped state. The test verified removal, an immediate retry, and protection of unrelated registrations, files, junctions and a populated index lock. An MSYS filter in the initial runner attempts outlived the configured checkout deadline. Linux tests cover the full timeout-to-cleanup sequence. The reporter's Windows 11 desktop and original repository were not used. The final head removes the temporary job. The worker code, test code and pinned dependencies are identical to the Windows-verified revision.Fixes: #982