Repository navigation
fix(worktrees): allow longer checkouts when creating threads - #915
Merged
Merged
Conversation
Give worktree creation 60 seconds instead of the 15-second metadata limit, keeping it within the gateway wait alongside an optional fetch. Cover slow checkout through the real worker link. Fixes: #74
nixuuu
enabled auto-merge (squash)
November 17, 2026 08:10
This was referenced Nov 17, 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
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.
Change
Creating a thread with a new worktree can fail with “git exceeded its time or output limit” when checking out a large repository, especially on Windows. Give
git worktree adda dedicated 60-second limit instead of the 15-second limit for Git metadata reads. Quiet mode suppresses progress output while preserving errors.The optional fetch keeps its 20-second limit, within the gateway's existing 90-second wait. Update the worktrees documentation and add a real gateway–worker regression test with a 16-second checkout hook that verifies the resulting thread, files, and HEAD.
Verification
bun run check:tmp ./tests/integration/worktrees.test.ts: 16 passed, including the slow checkout; no temporary files left. Used a separate temporary directory because the system temporary directory reached its quota.bun run lint -- apps/worker/src/git/worktrees.ts tests/integration/worktrees.test.ts: passed.git diff --check: passed.Fixes: #74