Skip to content

fix(worktree): make checkout timeout configurable - #192

Open
bold84 wants to merge 1 commit into
tintinweb:masterfrom
bold84:fix/configurable-worktree-timeout
Open

fix(worktree): make checkout timeout configurable#192
bold84 wants to merge 1 commit into
tintinweb:masterfrom
bold84:fix/configurable-worktree-timeout

Conversation

@bold84

@bold84 bold84 commented Jul 31, 2026

Copy link
Copy Markdown

Summary

  • Make worktree checkout time configurable through worktreeTimeoutSeconds in global/project subagents.json.
  • Add an auto strategy that scales from tracked file count (60-second floor, 5 ms per tracked file, 30-minute cap) plus bounded fixed values from 30 to 3600 seconds.
  • Expose the setting through /agents -> Settings -> Worktree timeout.
  • Clean up partial worktrees after failed or timed-out checkout attempts and terminate the Git process tree on Windows when possible.
  • Use git rev-parse --show-prefix for subdirectory mapping so Windows 8.3 and long path forms do not produce an incorrect workPath.

Motivation

The previous implementation used a hardcoded 30-second execFileSync timeout. On a Windows repository with approximately 85,550 tracked files, checkout exceeded that limit and surfaced the generic “not a git repo / no commits / git worktree add failed” error. The timed-out checkout could also leave a locked partial worktree behind.

Validation

  • npm run typecheck
  • npm run lint
  • npm run build
  • npm test -- test/settings.test.ts test/worktree.test.ts — 79 tests passed

The complete suite was also run on Windows. 42 files passed; the remaining failures are existing environment-sensitive tests that assume POSIX path formatting or an empty global custom-agent directory.

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