The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(cli): approval and clarify panels wait until answered
Brooklyn Nicholsonea5b89fa3596
diff --git a/hermes_cli/cli_chat_turn_mixin.py b/hermes_cli/cli_chat_turn_mixin.pyindex 1a7b160e4d4..c8b8dcb5e53 100644--- a/hermes_cli/cli_chat_turn_mixin.py+++ b/hermes_cli/cli_chat_turn_mixin.py@@ -345,6 +345,9 @@ class CLIChatTurnMixin:_persist_clean_user_message = message if (turn.voice_prefix or agent_message != message) else None_one_turn_model_restore = getattr(self, "_pending_one_turn_model_restore", None)self._pending_one_turn_model_restore = None+ # The user is at this terminal: approval and clarify prompts wait until answered or Ctrl+C.+ from tools.approval_context import reset_prompts_wait_for_answer, set_prompts_wait_for_answer+ _prompts_token = set_prompts_wait_for_answer()try:from agent.notification_presentation import notification_turnmuted = getattr(turn, "mute_notification_reply", False)@@ -395,6 +398,7 @@ class CLIChatTurnMixin:reset_current_session_key(_approval_session_token)except Exception:pass+ reset_prompts_wait_for_answer(_prompts_token)def _chat_monitor_agent_thread(self, turn, agent_thread):"""Poll the interrupt queue while the agent thread runs; returns the interrupting message (or None)."""diff --git a/hermes_cli/cli_modal_mixin.py b/hermes_cli/cli_modal_mixin.pyindex 139dd4566b6..f460db6c616 100644--- a/hermes_cli/cli_modal_mixin.py+++ b/hermes_cli/cli_modal_mixin.py@@ -586,13 +586,6 @@ class CLIModalMixin:_run_on_app_loop(app, _emit)- def _clarify_teardown(self) -> None:- self._clarify_state = None- self._clarify_freetext = False- self._clarify_deadline = None- self._clarify_multi_base = None- self._paint_now()-# --- Connection setup --------------------------------------------------def _connection_operation(self, payload):from tools.connectors import live@@ -998,13 +991,9 @@ class CLIModalMixin:def _clarify_callback(self, questions):"""Clarify-tool platform callback (agent thread, #18450): the batch panel (A-compact) shows- all questions, one active, and blocks until the key bindings lock every answer. Returns- ``{"answers": {qid: raw | None}, "outcome"}`` (None = skipped): ``submitted`` when every- question is locked, ``timed_out`` when the deadline expires, ``cancelled`` on an interrupt."""- from cli import CLI_CONFIG, _DIM, _RST, _cprint- from tools.clarify_gateway import resolve_clarify_timeout-- timeout = resolve_clarify_timeout(CLI_CONFIG)+ all questions, one active, and blocks until the key bindings lock every answer — no deadline;+ the user is at this terminal. Returns ``{"answers": {qid: raw | None}, "outcome"}`` (None =+ skipped): ``submitted`` when every question is locked, ``cancelled`` on an interrupt."""response_queue = queue.Queue()state = {"questions": list(questions),@@ -1020,19 +1009,13 @@ class CLIModalMixin:"selected_indices": None}self._clarify_state = stateself._clarify_batch_set_active(state, 0)- self._clarify_deadline = None if timeout <= 0 else _time.monotonic() + timeout+ self._clarify_deadline = Noneself._ring_bell(prompt=True, context=t("cli.clarify.bell_context"))self._paint_now()result = self._poll_modal_queue(response_queue, "_clarify_deadline")- if result is not _TIMED_OUT:- self._clarify_deadline = None- outcome = "cancelled" if result is None else "submitted"- return {"answers": dict(state["answers"]), "outcome": outcome}- partial = dict(state["answers"])- self._clarify_teardown()- _cprint(f"\n{_DIM}{t('cli.clarify.timed_out_locked_answers', timeout=timeout)}{_RST}")- return {"answers": partial, "outcome": "timed_out"}+ outcome = "cancelled" if result is None else "submitted"+ return {"answers": dict(state["answers"]), "outcome": outcome}def _sudo_password_callback(self) -> str:"""Prompt for a sudo password through the prompt_toolkit UI (agent thread); clarify-style@@ -1067,13 +1050,11 @@ class CLIModalMixin:"""Dangerous-command approval through the prompt_toolkit UI (agent thread).Choices: once / session / always / deny (see ``_approval_choices``), plus 'view' for long- commands. ``_approval_lock`` serializes concurrent requests (parallel delegation subtasks)- so the shared ``_approval_state`` / ``_approval_deadline`` aren't clobbered.+ commands. The panel stays up until the user answers (Ctrl+C interrupts the turn).+ ``_approval_lock`` serializes concurrent requests (parallel delegation subtasks) so the+ shared ``_approval_state`` isn't clobbered."""- from cli import CLI_CONFIG, _DIM, _RST, _cprint-with self._approval_lock:- timeout = int(CLI_CONFIG.get("approvals", {}).get("timeout", 300))response_queue = queue.Queue()self._approval_state = {"command": command,@@ -1085,7 +1066,7 @@ class CLIModalMixin:smart_denied=smart_denied),"selected": 0,"response_queue": response_queue}- self._approval_deadline = _time.monotonic() + timeout+ self._approval_deadline = Noneself._ring_bell(prompt=True, context=t("cli.approval.bell_context"), detail=command)self._paint_now()@@ -1093,11 +1074,6 @@ class CLIModalMixin:self._approval_state = Noneself._approval_deadline = 0self._paint_now()- if result is _TIMED_OUT:- _cprint(f"\n{_DIM} {t('cli.approval.timeout_denying')}{_RST}")- self._persist_prompt_summary(- "⚠", t("cli.approval.label"), command, t("cli.approval.timed_out_no_response"))- return "timeout"self._persist_prompt_summary("⚠", t("cli.approval.label"), command, _approval_outcome_label(result))return resultdiff --git a/hermes_cli/cli_tui_mixin.py b/hermes_cli/cli_tui_mixin.pyindex ee1b737ad63..a4e2ebe2768 100644--- a/hermes_cli/cli_tui_mixin.py+++ b/hermes_cli/cli_tui_mixin.py@@ -754,19 +754,17 @@ class CLITuiMixin:or self._sudo_state.get("vault_code")):hint_key = "cli.tui.hint_vault_username"hint = " " + t(hint_key)- remaining = max(0, int(getattr(self, deadline_attr) - time.monotonic()))- return [('class:hint', hint), ('class:clarify-countdown', f' ({remaining}s)')]+ deadline = getattr(self, deadline_attr)+ # None deadline = waits until answered → no countdown.+ countdown = '' if deadline is None else f' ({max(0, int(deadline - time.monotonic()))}s)'+ return [('class:hint', hint), ('class:clarify-countdown', countdown)]if self._clarify_state:- # None deadline = unlimited wait → hide the countdown entirely.- if self._clarify_deadline is None:- countdown = ''- else:- countdown = f' ({max(0, int(self._clarify_deadline - time.monotonic()))}s)'+ # Clarify waits until answered → no countdown.if self._clarify_freetext:hint = " " + t("cli.tui.hint_clarify_freetext")else:hint = " " + t("cli.tui.hint_clarify_batch")- return [('class:hint', hint), ('class:clarify-countdown', countdown)]+ return [('class:hint', hint), ('class:clarify-countdown', '')]if self._command_running:frame = self._command_spinner_frame()if self._command_blocks_input:diff --git a/locales/af.yaml b/locales/af.yamlindex 96233b5f9e3..a83df85b7d8 100644--- a/locales/af.yaml+++ b/locales/af.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "goedkeuring"label: "Goedkeuring"- timeout_denying: "⏱ Tyd verstreke — opdrag word geweier"- timed_out_no_response: "tyd verstreke (geen antwoord)"outcome_once: "eenmalig toegelaat"outcome_session: "vir sessie toegelaat"outcome_always: "by toelaatlys gevoeg"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "verduideliking"label: "Verduidelik"- timed_out_locked_answers: "(verduideliking se tyd het na {timeout}s verstryk — vasgestelde antwoorde teruggestuur)"connect:bell_context: "verbindingsopstelling"cannot_restart: "Hierdie verbinding kan nie weer begin word nie. Kanselleer en vra die agent weer."diff --git a/locales/ar.yaml b/locales/ar.yamlindex 55e8ae7dc0f..71467b9318a 100644--- a/locales/ar.yaml+++ b/locales/ar.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "الموافقة"label: "الموافقة"- timeout_denying: "⏱ انتهت المهلة — رفض الأمر"- timed_out_no_response: "انتهت المهلة (لا استجابة)"outcome_once: "مسموح مرة واحدة"outcome_session: "مسموح لهذه الجلسة"outcome_always: "أُضيف إلى قائمة السماح"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "استيضاح"label: "استيضاح"- timed_out_locked_answers: "(انتهت مهلة الاستيضاح بعد {timeout} ث — أُعيدت الإجابات المثبّتة)"connect:bell_context: "إعداد الاتصال"cannot_restart: "لا يمكن بدء هذا الاتصال مجددًا. ألغِ واطلب من الوكيل مرة أخرى."diff --git a/locales/de.yaml b/locales/de.yamlindex f8770664dd3..780734baaba 100644--- a/locales/de.yaml+++ b/locales/de.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "Genehmigung"label: "Genehmigung"- timeout_denying: "⏱ Zeitüberschreitung — Befehl wird abgelehnt"- timed_out_no_response: "Zeitüberschreitung (keine Antwort)"outcome_once: "einmalig erlaubt"outcome_session: "für diese Sitzung erlaubt"outcome_always: "zur Erlaubnisliste hinzugefügt"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "Rückfrage"label: "Rückfrage"- timed_out_locked_answers: "(Rückfrage nach {timeout}s abgelaufen — festgelegte Antworten zurückgegeben)"connect:bell_context: "Verbindungseinrichtung"cannot_restart: "Diese Verbindung kann nicht erneut gestartet werden. Brechen Sie ab und fragen Sie den Agenten erneut."diff --git a/locales/en.yaml b/locales/en.yamlindex 2c4d962f93d..3bf2504323f 100644--- a/locales/en.yaml+++ b/locales/en.yaml@@ -2352,8 +2352,6 @@ cli:approval:bell_context: "approval"label: "Approval"- timeout_denying: "⏱ Timeout — denying command"- timed_out_no_response: "timed out (no response)"outcome_once: "allowed once"outcome_session: "allowed for session"outcome_always: "added to allowlist"@@ -2361,7 +2359,6 @@ cli:clarify:bell_context: "clarify"label: "Clarify"- timed_out_locked_answers: "(clarify timed out after {timeout}s — locked answers returned)"connect:bell_context: "connection setup"cannot_restart: "This connection cannot be started again. Cancel and ask the agent again."diff --git a/locales/es.yaml b/locales/es.yamlindex 8bff49efd48..48ca84fd5f1 100644--- a/locales/es.yaml+++ b/locales/es.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "aprobación"label: "Aprobación"- timeout_denying: "⏱ Tiempo agotado — denegando el comando"- timed_out_no_response: "tiempo agotado (sin respuesta)"outcome_once: "permitido una vez"outcome_session: "permitido para la sesión"outcome_always: "añadido a la lista de permitidos"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "aclaración"label: "Aclarar"- timed_out_locked_answers: "(la aclaración expiró tras {timeout}s — se devolvieron las respuestas fijadas)"connect:bell_context: "configuración de conexión"cannot_restart: "Esta conexión no se puede iniciar de nuevo. Cancela y vuelve a pedírselo al agente."diff --git a/locales/fr.yaml b/locales/fr.yamlindex c8ed38817d6..ad2d991d9a8 100644--- a/locales/fr.yaml+++ b/locales/fr.yaml@@ -2525,8 +2525,6 @@ cli:approval:bell_context: "approbation"label: "Approbation"- timeout_denying: "⏱ Délai dépassé — commande refusée"- timed_out_no_response: "délai dépassé (aucune réponse)"outcome_once: "autorisé une fois"outcome_session: "autorisé pour la session"outcome_always: "ajouté à la liste d'autorisation"@@ -2534,7 +2532,6 @@ cli:clarify:bell_context: "clarification"label: "Clarification"- timed_out_locked_answers: "(clarification expirée après {timeout} s — réponses verrouillées renvoyées)"connect:bell_context: "configuration de connexion"cannot_restart: "Cette connexion ne peut pas être relancée. Annulez et redemandez à l'agent."diff --git a/locales/ga.yaml b/locales/ga.yamlindex f50807f7a93..ff28d1a3190 100644--- a/locales/ga.yaml+++ b/locales/ga.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "cead"label: "Cead"- timeout_denying: "⏱ Teorainn ama — ag diúltú don ordú"- timed_out_no_response: "imithe thar am (gan freagra)"outcome_once: "ceadaithe uair amháin"outcome_session: "ceadaithe don seisiún"outcome_always: "curtha leis an liosta ceadaithe"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "soiléiriú"label: "Soiléirigh"- timed_out_locked_answers: "(chuaigh an soiléiriú thar am tar éis {timeout}s — seoladh na freagraí glasáilte ar ais)"connect:bell_context: "socrú ceangail"cannot_restart: "Ní féidir an ceangal seo a thosú arís. Cealaigh agus iarr ar an ngníomhaire arís."diff --git a/locales/hu.yaml b/locales/hu.yamlindex 709a3c30fd2..f00d816e946 100644--- a/locales/hu.yaml+++ b/locales/hu.yaml@@ -2269,8 +2269,6 @@ cli:approval:bell_context: "jóváhagyás"label: "Jóváhagyás"- timeout_denying: "⏱ Időtúllépés — a parancs elutasítva"- timed_out_no_response: "időtúllépés (nem jött válasz)"outcome_once: "egyszer engedélyezve"outcome_session: "a munkamenetre engedélyezve"outcome_always: "engedélyezőlistára téve"@@ -2278,7 +2276,6 @@ cli:clarify:bell_context: "pontosítás"label: "Pontosítás"- timed_out_locked_answers: "(a pontosítás {timeout} mp után lejárt — a rögzített válaszok visszaküldve)"connect:bell_context: "kapcsolat beállítása"cannot_restart: "Ezt a kapcsolatot nem lehet újraindítani. Szakítsd meg, és kérd újra az ügynöktől."diff --git a/locales/it.yaml b/locales/it.yamlindex d52ad4520fc..38a08ac7c92 100644--- a/locales/it.yaml+++ b/locales/it.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "approvazione"label: "Approvazione"- timeout_denying: "⏱ Timeout — comando negato"- timed_out_no_response: "timeout (nessuna risposta)"outcome_once: "consentito una volta"outcome_session: "consentito per la sessione"outcome_always: "aggiunto alla allowlist"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "chiarimento"label: "Chiarimento"- timed_out_locked_answers: "(chiarimento scaduto dopo {timeout}s — restituite le risposte bloccate)"connect:bell_context: "configurazione connessione"cannot_restart: "Questa connessione non può essere riavviata. Annulla e chiedi di nuovo all'agente."diff --git a/locales/ja.yaml b/locales/ja.yamlindex 32cdd7a572d..b07d8c67171 100644--- a/locales/ja.yaml+++ b/locales/ja.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "承認"label: "承認"- timeout_denying: "⏱ タイムアウト — コマンドを拒否します"- timed_out_no_response: "タイムアウト(応答なし)"outcome_once: "今回のみ許可"outcome_session: "セッション中は許可"outcome_always: "許可リストに追加"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "確認"label: "確認"- timed_out_locked_answers: "(確認は {timeout} 秒でタイムアウトしました — 確定済みの回答を返しました)"connect:bell_context: "接続のセットアップ"cannot_restart: "この接続は再開できません。キャンセルして、エージェントにもう一度依頼してください。"diff --git a/locales/ko.yaml b/locales/ko.yamlindex 8d04d88fba3..9a93e00abcf 100644--- a/locales/ko.yaml+++ b/locales/ko.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "승인"label: "승인"- timeout_denying: "⏱ 시간 초과 — 명령을 거부해요"- timed_out_no_response: "시간 초과 (응답 없음)"outcome_once: "한 번 허용됨"outcome_session: "세션 동안 허용됨"outcome_always: "허용 목록에 추가됨"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "명확화"label: "명확화"- timed_out_locked_answers: "(명확화 요청이 {timeout}초 후 시간 초과 — 확정된 답변을 반환했어요)"connect:bell_context: "연결 설정"cannot_restart: "이 연결은 다시 시작할 수 없어요. 취소한 뒤 에이전트에게 다시 요청해 주세요."diff --git a/locales/pt.yaml b/locales/pt.yamlindex 6d1b8fd946a..32b4f487a59 100644--- a/locales/pt.yaml+++ b/locales/pt.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "aprovação"label: "Aprovação"- timeout_denying: "⏱ Tempo limite — negando o comando"- timed_out_no_response: "tempo limite esgotado (sem resposta)"outcome_once: "permitido uma vez"outcome_session: "permitido para a sessão"outcome_always: "adicionado à lista de permissões"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "esclarecimento"label: "Esclarecer"- timed_out_locked_answers: "(esclarecimento expirou após {timeout}s — respostas travadas retornadas)"connect:bell_context: "configuração de conexão"cannot_restart: "Esta conexão não pode ser iniciada novamente. Cancele e peça ao agente de novo."diff --git a/locales/ru.yaml b/locales/ru.yamlindex 8d5f7790a58..9ac26bc28b5 100644--- a/locales/ru.yaml+++ b/locales/ru.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "одобрение"label: "Одобрение"- timeout_denying: "⏱ Тайм-аут — команда отклонена"- timed_out_no_response: "тайм-аут (нет ответа)"outcome_once: "разрешено один раз"outcome_session: "разрешено на сеанс"outcome_always: "добавлено в список разрешённых"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "уточняющий вопрос"label: "Уточнение"- timed_out_locked_answers: "(уточняющий вопрос: тайм-аут через {timeout} с — возвращены зафиксированные ответы)"connect:bell_context: "настройка подключения"cannot_restart: "Это подключение нельзя запустить повторно. Отмените и попросите агента ещё раз."diff --git a/locales/tr.yaml b/locales/tr.yamlindex 820279f9c58..e9120093961 100644--- a/locales/tr.yaml+++ b/locales/tr.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "onay"label: "Onay"- timeout_denying: "⏱ Zaman aşımı — komut reddediliyor"- timed_out_no_response: "zaman aşımı (yanıt yok)"outcome_once: "bir kez izin verildi"outcome_session: "oturum için izin verildi"outcome_always: "izin listesine eklendi"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "netleştirme"label: "Netleştirme"- timed_out_locked_answers: "(netleştirme {timeout} sn sonra zaman aşımına uğradı — kilitlenen yanıtlar döndürüldü)"connect:bell_context: "bağlantı kurulumu"cannot_restart: "Bu bağlantı yeniden başlatılamaz. İptal edip ajana tekrar sorun."diff --git a/locales/uk.yaml b/locales/uk.yamlindex e32c98fdf6c..2e400425006 100644--- a/locales/uk.yaml+++ b/locales/uk.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "схвалення"label: "Схвалення"- timeout_denying: "⏱ Час вийшов — команду відхилено"- timed_out_no_response: "час вийшов (без відповіді)"outcome_once: "дозволено один раз"outcome_session: "дозволено для сеансу"outcome_always: "додано до списку дозволених"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "уточнення"label: "Уточнення"- timed_out_locked_answers: "(час на уточнення вийшов через {timeout} с — повернено зафіксовані відповіді)"connect:bell_context: "налаштування підключення"cannot_restart: "Це підключення не можна запустити повторно. Скасуйте й попросіть агента ще раз."diff --git a/locales/zh-hant.yaml b/locales/zh-hant.yamlindex 6feb17baac1..a10f4a10ce4 100644--- a/locales/zh-hant.yaml+++ b/locales/zh-hant.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "批准"label: "批准"- timeout_denying: "⏱ 逾時 — 拒絕指令"- timed_out_no_response: "已逾時(無回應)"outcome_once: "允許一次"outcome_session: "本工作階段允許"outcome_always: "已加入允許清單"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "澄清"label: "澄清"- timed_out_locked_answers: "(澄清已在 {timeout} 秒後逾時 — 已回傳鎖定的答案)"connect:bell_context: "連線設定"cannot_restart: "此連線無法再次啟動。請取消後再向代理提出一次。"diff --git a/locales/zh.yaml b/locales/zh.yamlindex f8102088f31..2a020517c69 100644--- a/locales/zh.yaml+++ b/locales/zh.yaml@@ -2252,8 +2252,6 @@ cli:approval:bell_context: "审批"label: "审批"- timeout_denying: "⏱ 超时——拒绝执行命令"- timed_out_no_response: "已超时(无响应)"outcome_once: "已允许一次"outcome_session: "本会话内已允许"outcome_always: "已加入允许列表"@@ -2261,7 +2259,6 @@ cli:clarify:bell_context: "澄清"label: "澄清"- timed_out_locked_answers: "(澄清在 {timeout} 秒后超时——已返回锁定的答案)"connect:bell_context: "连接设置"cannot_restart: "此连接无法再次启动。请取消后重新向代理发起请求。"diff --git a/tests/hermes_cli/test_cli_approval_ui.py b/tests/hermes_cli/test_cli_approval_ui.pyindex feec4091d65..b015dc96e73 100644--- a/tests/hermes_cli/test_cli_approval_ui.py+++ b/tests/hermes_cli/test_cli_approval_ui.py@@ -68,6 +68,28 @@ def _make_background_cli_stub():class TestCliApprovalUi:+ def test_panel_waits_for_an_answer_past_approvals_timeout(self):+ """The CLI is attended: ``approvals.timeout`` (the messaging knob) must not deny an unanswered+ panel, and the hint row shows no countdown."""+ cli = _make_cli_stub()+ cli._secret_state = cli._slash_confirm_state = cli._connection_state = cli._clarify_state = None+ result = {}+ with patch("cli.CLI_CONFIG", {"approvals": {"timeout": 1}}):+ thread = threading.Thread(+ target=lambda: result.__setitem__("value", cli._approval_callback("rm -rf /tmp/x", "delete")),+ daemon=True)+ thread.start()+ deadline = time.time() + 2+ while cli._approval_state is None and time.time() < deadline:+ time.sleep(0.01)+ thread.join(timeout=2.5)+ assert thread.is_alive() and cli._approval_state is not None+ assert cli._approval_deadline is None+ assert cli._tui_hint_text()[-1] == ('class:clarify-countdown', '')+ cli._approval_state["response_queue"].put("once")+ thread.join(timeout=2)+ assert result["value"] == "once"+def test_smart_denied_callback_offers_only_once_and_deny(self):cli = _make_cli_stub()result = {}diff --git a/tests/hermes_cli/test_cli_clarify_batch.py b/tests/hermes_cli/test_cli_clarify_batch.pyindex 8a7d35764a0..5b4388c46cb 100644--- a/tests/hermes_cli/test_cli_clarify_batch.py+++ b/tests/hermes_cli/test_cli_clarify_batch.py@@ -141,23 +141,26 @@ class TestClarifyBatchPanel:"answers": {"q0": "thorough", "q1": "narrow"}, "outcome": "submitted"}- def test_timeout_returns_partials_with_timed_out_outcome(self):+ def test_panel_waits_for_an_answer_past_the_messaging_clarify_timeout(self):+ """The CLI is attended: a short ``agent.clarify_timeout`` (the messaging knob) must not time the+ panel out — it stays up with locked answers intact until the last question is locked."""cli = _make_cli_stub()questions = [_q(0, "Answered?", ["yes", "no"]),- _q(1, "Never answered?", ["x", "y"]),+ _q(1, "Answered later?", ["x", "y"]),]- with patch(- "tools.clarify_gateway.resolve_clarify_timeout", return_value=1- ):+ with patch("cli.CLI_CONFIG", {"agent": {"clarify_timeout": 1}}):thread, result = _start_batch(cli, questions)state = cli._clarify_statecli._clarify_batch_enter(state) # lock q0 only- thread.join(timeout=5)+ thread.join(timeout=2.5)+ assert thread.is_alive()+ assert cli._clarify_state is state and cli._clarify_deadline is None+ cli._clarify_batch_enter(state) # lock q1+ thread.join(timeout=2)assert not thread.is_alive()- assert result["value"] == {"answers": {"q0": "yes"}, "outcome": "timed_out"}- assert cli._clarify_state is None+ assert result["value"] == {"answers": {"q0": "yes", "q1": "x"}, "outcome": "submitted"}def test_multi_select_lock_produces_json_array_string(self):cli = _make_cli_stub()@@ -378,9 +381,7 @@ class TestClarifyBellOnPrompt:cli = _make_cli_stub()cli.bell_on_prompt = bell_on_promptout = io.StringIO()- with patch("cli.sys.stdout", out), patch(- "tools.clarify_gateway.resolve_clarify_timeout", return_value=60- ):+ with patch("cli.sys.stdout", out):thread = threading.Thread(target=cli._clarify_callback, args=([_q(0, "Color?", ["red", "blue"])],), daemon=True)