Yes, it's a common practice to check to ensure your client is not buying a problem that will come back to haunt them later. You have two choices - to sell the house as-is with disclosure of the non-compliant construction or get a permit and have the city sign off on it once it meets code.
Regardless of your choice, one thing is clear. Once you know that unpermitted construction was done on your home, you must, by law, disclose the issue to all potential buyers. You’ll most likely do this on a state-specific disclosure statement, which typically (in most states) asks the seller to report any known legal issues or unpermitted construction on the property.
As for your agent losing his/her license, your Realtor is required to disclose things they know or "should have known" were improper so fairness is provided to all parties. Your state board could take action if they feel his/her actions were not sufficiently forthcoming to provide fairness to all as it impacts the impression of the profession.
You're best bet is to have the repair done to code and remove the worry of it ever coming back on you.
Good luck!