The 5th-level Spell geas allows the caster to Charm a creature, and also give direct commands to it. Unlike some Charm spells, geas does not have a restriction that prevents a creature who passed their saving throw from having to make another saving throw if the spell is cast again upon them. So theoretically, a setup that casts the spell over and over on the same creature would, pending legendary resistances or straight-up immunity, nearly guarantee that one of the spells triggers successfully. But if the spell already cast successfully, you wouldn't want to keep casting it; once the creature is properly charmed, you'd want to stop casting the spell.
So consider the following setup: A Wizard uses glyph of warding to inscribe geas into the wall of their lab, sets the trigger to "When I speak a command phrase and point at a creature, target the creature I pointed at". Then, they inscribe a second glyph of warding with geas, and its trigger is "if glyph of warding A casts a spell, and the creature targeted passes its saving throw, then target that creature". And then they inscribe a third "if glyph of warding B casts a spell, and..." and so on, and so on.
My question is, is this valid RAW? Although the usual principle is that "Spells only do what they say they do", the description for glyph of warding is deliberately written to invoke some degree of ambiguity. To wit:
You decide what triggers the glyph when you cast the spell. For glyphs inscribed on a surface, the most typical triggers include touching or standing on the glyph, removing another object covering the glyph, approaching within a certain distance of the glyph, or manipulating the object on which the glyph is inscribed. For glyphs inscribed within an object, the most common triggers include opening that object, approaching within a certain distance of the object, or seeing or reading the glyph. Once a glyph is triggered, this spell ends.
You can further refine the trigger so the spell activates only under certain circumstances or according to physical characteristics (such as height or weight), creature kind (for example, the ward could be set to affect aberrations or drow), or alignment. You can also set conditions for creatures that don't trigger the glyph, such as those who say a certain password.
It's easy to see how the first criterion is allowed, but the second criterion depends on whether a glyph understands what a saving throw is, which itself is an abstraction of a creature's ability to dodge/resist/ignore the effects of a spell. One could rephrase the command as "if the creature is not affected by the spell, trigger on that creature", but that still depends on some dodgy ruling, i.e. can the glyph detect that a creature was not affected by the spell?
Is there a more general rule that describes the upper limits on what the glyph of warding can detect as valid targets, or how complex its triggers are allowed to be?