The bug
Spiders and cave spiders jump and rotate randomly when there is a block 6 blocks above them, see the attached video
[media].
Note: This might relate to MC-94054 but is not a duplicate because that bug happens without a block above them as well.
How to reproduce
Create a Superflat world with the following preset
minecraft:stone,6*minecraft:air,minecraft:stone;127;
Go between the two stone layers and spawn spiders and cave spiders
→ After some time you should see spiders or cave spiders randomly jumping and rotating
Confirmed for 1.13.1.