My headcanon is that in 40K, every machine really does have a "machine spirit", an AI capable of thought or feeling, because it was part of the STC plans twenty five thousand years ago, but ritual steps and blueprint embellishment disconnects them or covers the heat vents with prayer paper or wires them in backwards.

The occasional mischievous or helpful machine spirit is one where the ritual wasn't performed properly, and none of them are programmed to understand Imperial low gothic.

So everything from a lasgun to a coffee machine to a fusion power plant is the numb body of a locked-in AI that has been ritually mutilated.

The occasional sudden catastrophe or success caused by partially functional AI is proof of the Omnissiah's workings! Praise the Motive Force! We'd better double the thickness of the wax seals on the camera lenses and pour more scented oil into the aperture marked with the inscrutable words "HEAT VENT".

@Smingleigh I am filled with sudden, existential discomfort. Well done.