_frontend/app.py: Flush cached messages when handling a failure. It's very confusing to get an interactive prompt and not see the detailed failure message on screen - make sure we print the pending messages when handling a failure.