Both of the guards have a handle. If the guard that always lies pulls his handle, then the minecart will divert to the second track. If both guards pull their handle, the prisoners will be released. One of the handles is covered by a wooden box, where half of the wooden planks of the original box have been replaced by new ones cut from a tree that fell when nobody was around. If guard A is taller than guard B, are we getting paid for this quest?

I dunno, can’t see the Sun from inside a dungeon

This one’s the Truthsayer, other one is a liar.

Unless he absolutely does know which way is west because he has, like, gone outside at least once. Or owns a compass.

Sounds like we’re making a lot of modifications to the setting here, but that would require the other guard to also not know because he actually doesn’t. If either of them makes a definitive answer which you can then verify, then you can solve it.

The part about not being able to see the sun is almost certainly true, though, and the usual premise of the riddle is that one of them ONLY tells the truth and one ONLY lies.

As such, either you’re in something as implausible as a dungeon with a skylight or that guard is the truth teller.

What if the other one also answers they don’t know?

I mentioned in the adjacent comment thread that circumstance: if one of them gives a verifiable answer then it is solved, if neither of them know: that requires one of them does know and is lying and one actually doesn’t know, which is a very odd stipulation, but you can just ask them any other question with one true answer. “What is 2 + 2?”

For this concept to work you need to only be allowed one question, I reckon

Wrong. If one points a direction, they may have just been actually familiar with the layout of the castle.

Yes. That’s exactly the point. If one of them points west, he is telling the truth. If one of them points any other directions then they’re a liar. The only way this prompt doesn’t work is if one of them knows and lies about knowing and the other actually doesn’t know, which is a very hyper-specific circumstance.