Note that it is quite hard to do such spellcasting to begin with
Contingency
It states
Choose a spell of 5th level or lower that you can cast
So you can not use it along Wish, which is a 9th level spell.
Glyph of Warding
While Glyph of Warding theoretically allows you to store Wish as it states
At Higher Levels: When you cast this spell using a spell slot of 4th Level or higher, the damage of an explosive runes glyph increases by 1d8 for each slot level above 3rd. If you create a spell glyph, you can store any spell of up to the same level as the slot you use for the glyph of warding.
The problem here is that doing it would require you to spend two spell slots of 9th level at the same time. However, this answer suggests that you can use a Spell Scroll or other magic items to cast Wish and fulfill the requirement. I am not entirely sure about that, but I will go along with it.
If you manage to do it
I would go with the answer up to the DM.
From my reading, it is a question of whether the effect of Wish is decided upon cast or upon "resolve". So, I see two ways this could work out:
- If the effect is decided upon cast, then the person casting Glyph and Wish decides the effect of Wish beforehand.
- If the effect is decided upon resolving, then the person triggering the Glyph is granted a Wish, and he decides the effect.
Wish is, by itself, a spell that requires the DM to adjudicate a lot, thus letting the DM make the call on which interpretation should run seems fine.
Personally, depending on the intention of the player doing this trick, I would let them do the one more convenient for their plan (e.g., if they want to create somewhat of a magic lamp, sure, go for it). Unless you are running an official AL table (in which case I am not sure you can get items that allow casting Wish), the rules are guidelines but having fun is more important.