Skip to content

fix(worktrees): allow longer checkouts when creating threads - #915

Merged
nixuuu merged 1 commit into
devfrom
fix/worktree-creation-error
Nov 17, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/worktree-creation-error

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 17, 2026

Copy link
Copy Markdown
Member

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 add a 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.
  • Edited TypeScript files formatted; git diff --check: passed.
  • Local verification ran on Linux. Windows confirmation and the full verification gate remain with CI.
  • No UI text changed; copy audit does not apply.

Fixes: #74

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
nixuuu enabled auto-merge (squash) November 17, 2026 08:10
@nixuuu
nixuuu merged commit 48a2d18 into dev Nov 17, 2026
26 of 29 checks passed
@nixuuu
nixuuu deleted the fix/worktree-creation-error branch November 17, 2026 08:24
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
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