Xcode 12.4 keeps asking to unlock the source file

The first time it asks - makes sense, because the file was not writeable.

But after that, even when the file is writeable, Xcode keeps asking the same question - after almost every edit.

The only way to get rid of the prompts is to close Xcode and start it again.

Almost as if Xcode caches the file attributes, and does not update when it makes the file writeable.

This happens on one of my Macs, not on others.

Any help on how to fix this would be greatly appreaciated!