Repository navigation
fix(git-clone): clean up the half-built destination after a timeout - #2357
Conversation
A timed-out clone was killed with git inside its checkout, and the
half-built destination stayed behind: every retry of the same name hit
CONFLICT ("already exists in that folder") until the user found and
deleted the residue by hand. The timeout path now removes the
destination — unlinking it instead of recursing when it is a symlink —
and the removal is best-effort for the case where git never created it.
Resolving the timeout right after SIGTERM let the cleanup race a git process tree that was still writing; on Windows `kill` is TerminateProcess and helpers such as git-remote-https keep running, so the removal failed with EBUSY and the residue stayed behind. The run now waits (bounded, then SIGKILL) for `close`, which only fires once every process holding the clone's stdio has exited. Cleanup is limited to a destination that was absent before git started, retries transient Windows lock errors, and logs a failure instead of swallowing it. fixes #2293
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review of the timeout/cleanup changes to runGitClone and cloneGitRepository plus their tests. The staged sequencing (resolve on close or after a kill grace, cleanup only for a destination proven absent before spawn) is coherent and the tests cover the described paths. No concrete behavioral defect is evidenced in the added lines, but no runtime execution, test run, Windows behavior, or full-file integration with surrounding code could be verified here.
No evidenced findings in the supplied diff.
Head: 73da9a3
Base: 525ec49
CI: success; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
Completes #2294 (author's commit preserved) with the changes requested in review, scoped to the clone path only (the unrelated agentCompact / sessionDelete commits are not included).
runGitCloneresolves a timeout only afterclose(git and every helper holding its stdio exited), bounded by a 15 s grace then SIGKILL, so cleanup no longer races live writers on Windows.fs.rmmaxRetries, and logs non-ENOENT failures.Tests:
node --test apps/desktop/test/git-clone.test.mjs17/17 (real child processes for the delayed-exit, SIGTERM-ignored and normal-exit paths; injected run for cleanup and the pre-existing entry).fixes #2293
Supersedes #2294