Detonating doesn't happen at part throttle or idle, fuel octane isn't the problem. Of all of the times I have run a 2-stroke into detonation, the sound was a higher pitched ticking/rattle, not a knock. The knocking could be any number of things, some serious and some benign. Piston slap is a possibility, especially if the bike has a lot of hours. If it's worse when the engine is cold, suspect piston slap. The knocking could be bad bearings. But, every 2-stroke I have ever heard knocked some at idle. Some of it comes from the power valves rattling every time the cylinder fires. Some of it is due to the shape of the 2-stroke piston. 2-stroke pistons expand a lot and the clearances towards the top of the piston are quite large, maybe .060"+. There is a lot of room for it to move around and make noise. If the bike has relatively few hours on it, I would set that as a baseline and listen for new knocks in the future as warnings of trouble. Otherwise, compare it to a similar bike with an engine you know is in good condition. You will always have some knocks and rattles, you need to devolop an ear for what is normal and what is abnormal.