diff --git a/frontends/tuiapp_v2.py b/frontends/tuiapp_v2.py index 6af579557..edae7b470 100644 --- a/frontends/tuiapp_v2.py +++ b/frontends/tuiapp_v2.py @@ -6133,8 +6133,8 @@ def _drain_ask_user_events(self, sess: AgentSession) -> None: while True: try: latest = sess.ask_user_events.get_nowait() except queue.Empty: break - if not latest: return - question = latest["question"]; candidates = latest["candidates"] + if not latest or not (candidates := latest.get("candidates")): return + question = latest["question"] multi = bool(self._MULTI_RE.search(question)) kind = "multi_choice" if multi else "choice" choices = [(c, c) for c in candidates] + [(FREE_TEXT_LABEL, FREE_TEXT_CHOICE)]