Skip to content

Race condition between concurrent Task processes when cloning remote Git Taskfiles #3011

Description

@QuentinBtd

Description

Description

Task intermittently fails while cloning a remote Git Taskfile when multiple Task processes run concurrently.

This occurs in normal development workflows, where Task may be invoked by an IDE extension, shell completion, or another terminal at the same time.

Error

failed to clone repository: error downloading 'https://example.com/example.git?depth=1&ref=v1.2.0': /usr/bin/git exited with 128: Cloning into '/private/tmp/task-git-repos/git/<repository-cache-key>'...
error: could not lock config file /private/tmp/task-git-repos/git/<repository-cache-key>/.git/config: No such file or directory
error: could not lock config file /private/tmp/task-git-repos/git/<repository-cache-key>/.git/config: No such file or directory
fatal: could not set 'core.repositoryformatversion' to '0'

Example Taskfile

version: '3'

includes:
  remote:
    taskfile: https://example.com/example.git//tasks/example/taskfile.yaml?ref=v1.2.0

Steps to reproduce

  1. Clear the remote Taskfile cache so that the Git repository needs to be cloned.
  2. Run multiple Task processes concurrently:
task --list &
task --list &
wait
  1. Repeat if necessary, as the failure is intermittent.

Expected behavior

Concurrent Task processes should resolve the remote Git Taskfile successfully.

Actual behavior

One or more processes intermittently fail during Git repository initialization because .git/config is no longer present.

Environment

  • Task version: 3.53.1
  • Operating system: macOS
  • Architecture: arm64
  • Remote Taskfile transport: Git over HTTPS

Version

3.53.1

Operating system

macOS

Experiments Enabled

No response

Example Taskfile

version: '3'

includes:
  remote:
    taskfile: https://example.com/example.git//tasks/example/taskfile.yaml?ref=v1.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: includesChanges related to included taskfiles.good first issueIssues that are good for first-time contributors to pick up.

    Type

    Fields

    No fields configured for bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions