Skip to content

robust-checkout: clear stale git locks left by a hard-killed fetch - #18

Merged
gavin0x01 merged 1 commit into
mainfrom
ci/robust-checkout-clear-stale-locks
Oct 29, 2026
Merged

gavin0x01 merged 1 commit into
mainfrom
ci/robust-checkout-clear-stale-locks

Conversation

@gavin0x01

Copy link
Copy Markdown
Collaborator

Fix: a fetch killed by 'timeout -s KILL' (SIGKILL, uncatchable) leaves .git/shallow.lock (and possibly index.lock/fetch-head.lock) behind, so every later round aborts with 'File exists / Another git process seems to be running' — observed in FlagGems run 40832357195 where rounds 4-5 failed on the stale lock, not the network. Remove stale *.lock at the start of each fetch attempt; nothing else touches the repo, so it is safe and is the only way the retry loop can recover after a hard-killed fetch. Verified: YAML valid, bash -n clean, cleanup removes the locks while keeping real .git files.

A fetch killed by 'timeout -s KILL' (SIGKILL is uncatchable) can't clean up
after itself, leaving .git/shallow.lock (from a shallow/depth fetch) and
possibly index.lock/fetch-head.lock behind. Every subsequent fetch then aborts
with "Unable to create '.../shallow.lock': File exists / Another git process
seems to be running", so a single killed round silently poisons all later
rounds — observed in FlagGems run 40832357195 where rounds 4-5 failed on the
stale lock rather than the network.

Remove stale *.lock at the start of each fetch attempt. Nothing else touches
the repo (the only prior git was the one we just killed), so this is safe and
is the only way the retry loop can recover from a hard-killed fetch.
@gavin0x01
gavin0x01 merged commit 6fe26ce into main Oct 29, 2026
1 check passed
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