From 4d2ac0780b86bb5e5f130da65947aef15d0289c8 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Tue, 29 Sep 2026 23:39:23 +0530 Subject: [PATCH] fix(actions): clone action runs without hardlinks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `race` failed on main with: TempDir RemoveAll cleanup: unlinkat .../action-work/1/src/.git: directory not empty `executeActionRun` clones the source with `git clone --local`, which hardlinks objects from the repository into the run directory. The deferred `os.RemoveAll(runDir)` then races the git process that may still be writing, and the test's TempDir cleanup loses. `pull_requests.go:535` already clones with `--no-hardlinks`; the action path was missed. Adding the same flag. Reproduces as an intermittent failure — 13 clean runs locally before the fix were possible — so the value here is removing the race, not a red-to-green flip. --- cmd/trace/actions.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/trace/actions.go b/cmd/trace/actions.go index a0c06ac..11aaabe 100644 --- a/cmd/trace/actions.go +++ b/cmd/trace/actions.go @@ -546,7 +546,11 @@ func (s *store) executeActionRun(ctx context.Context, run actionRun, config work return } } - cmd := exec.CommandContext(ctx, "git", "clone", "--no-checkout", "--local", repoPath, workspace) + // --no-hardlinks: a plain --local clone hardlinks the source objects, so + // removing the run directory races the still-running git process and can + // fail with ".git: directory not empty". pull_requests.go already clones + // this way. + cmd := exec.CommandContext(ctx, "git", "clone", "--no-checkout", "--local", "--no-hardlinks", repoPath, workspace) if out, err := cmd.CombinedOutput(); err != nil { if ctx.Err() != nil { s.finishActionRun(run.ID, "cancelled", []actionJob{{ID: 1, Name: "checkout", Status: "cancelled", ExitCode: 1, Log: "cancelled"}})