Warning, spoilers for Out of the Abyss below.
In Out of the Abyss, on pages 206-207, there is a trapped secret door described as follows:
Any party member with a passive Wisdom (Perception) score of 20 or higher notices a secret door in the wall. [...] Any creature with 12 Hit Dice or fewer that approaches within 5 feet of the secret door without speaking the word khaless ("trust") triggers an imprisonment spell (save DC l7). On a failed save the creature is trapped in minimus containment inside a gemstone in Gromph's inner sanctum (described in the next section). The trap ceases to exist once a creature becomes imprisoned. A successful dispel magic (DC l9) cast on the secret door removes the trap.
Grin (an NPC described on page 162) is a Drow Mage and only has 10 hit die, so he triggered the trap, failed the save and is now trapped. The party have taken a liking to Grin and wish to free him. How do they do that?
The imprisonment spell (PHB, pp. 252-253) says the following with regards to ending the spell (e.g. freeing Grin):
Ending the Spell. During the casting of the spell, in any of its versions, you can specify a condition that will cause the spell to end and release the target. The condition can be as specific or as elaborate as you choose, but the GM must agree that the condition is reasonable and has a likelihood of coming to pass. The conditions can be based on a creature's name, identity, or deity but otherwise must be based on observable actions or qualities and not based on intangibles such as level, class, or hit points.
A dispel magic spell can end the spell only if it is cast as a 9th-level spell, targeting either the prison or the special component used to create it.
The party is not level 17 yet, nor are they supposed to be (in fact, they're supposed to be only level 15 by the final boss fight) so they cannot cast dispel magic at 9th-level. So I assume the only way to free Grin (or what could have been a PC in someone else's game) is to have some kind of end condition met, but the adventure does not mention what this end condition is. Since the spell description says "you can specify...", I assume this means that Gromph did not specify and end condition.
Does this mean the creature (Grin in our case, potentially a PC in someone else's game) is stuck there until they either become or meet someone else who has 9th level spell slots and knows dispel magic? Or is there another end condition to this spell that I'm overlooking?