hermes-agent/ui-tui/src/app
Ben 825629424d fix(tui): persist timed-out/cancelled clarify prompts in transcript
When a clarify prompt times out (backend _block returns an empty answer
after the configured timeout) or is dismissed with Esc/Ctrl+C, the live
ClarifyPrompt overlay was torn down by turnController.idle() ->
resetFlowOverlays() with no persistent transcript record. The question and
options vanished from the screen while the agent's follow-up still referred
to "the options above".

The answered path already persists the question + answer; only the
unanswered exits left no trace. This asymmetry is the bug.

Fix (TUI layer only, no Python/protocol change):
- formatAbandonedClarify() in lib/text.ts renders the question + the same
  1-based numbered option list shown by ClarifyPrompt, plus a reason
  ('timed out' / 'cancelled').
- Timeout: createGatewayEventHandler flushes a still-live clarify into the
  transcript as a plain system line when the clarify tool's own tool.complete
  fires. A live capture of the event stream confirmed this is the only point
  where the overlay is still set after a timeout: the sequence is
  clarify.request -> (timeout) -> tool.complete -> message.complete, with NO
  intervening message.start/tool.start. On a real answer, answerClarify()
  clears the overlay before tool.complete arrives, so the hook no-ops there
  (no double-write); a per-requestId guard set is belt-and-braces.
- Explicit cancel: answerClarify('') persists the prompt as a system line
  instead of a transient 'prompt cancelled' flash.

System lines always render (unlike trail lines, which /details can hide),
so the record reliably survives on screen as standard output.

Verified live in the TUI: an Esc-cancelled clarify now leaves the question +
options + '(cancelled - no selection)' in the transcript after the turn ends.

Tests: formatAbandonedClarify unit cases + gateway-handler behavioral cases
(persist on clarify tool.complete, no flush on a non-clarify tool.complete,
no double-persist on repeat tool.complete, no-op when the overlay was already
cleared by an answer).
2026-06-04 16:25:54 -07:00
..
slash feat(tui): single /model command + unified Sessions overlay (#37112) 2026-06-01 22:28:36 -04:00
createGatewayEventHandler.ts fix(tui): persist timed-out/cancelled clarify prompts in transcript 2026-06-04 16:25:54 -07:00
createSlashHandler.ts feat(undo): /undo [N] backs up N user turns with prefill + soft-delete 2026-06-01 01:22:38 -07:00
delegationStore.ts feat(tui): subagent spawn observability overlay 2026-04-22 10:38:17 -05:00
gatewayContext.tsx feat: add inline token count etc and fix venv 2026-04-15 10:20:56 -05:00
gatewayRecovery.ts fix(tui): auto-recover session on unexpected gateway death (+ persist lifecycle breadcrumbs) (#35893) 2026-05-31 10:36:57 -05:00
inputSelectionStore.ts fix(tui): mouse + keyboard text selection in the composer (#16732) 2026-04-27 16:43:48 -07:00
interfaces.ts feat(tui): single /model command + unified Sessions overlay (#37112) 2026-06-01 22:28:36 -04:00
overlayStore.ts feat(tui): single /model command + unified Sessions overlay (#37112) 2026-06-01 22:28:36 -04:00
scroll.ts fix(tui): refresh scroll height at cached bottom 2026-05-07 05:48:19 -07:00
setupHandoff.ts feat(tui): /model and /setup slash commands with in-place CLI handoff 2026-04-17 10:58:18 -05:00
spawnHistoryStore.ts fix(tui): handle timeout/error subagent statuses in /agents (#26687) 2026-05-15 20:19:02 -05:00
turnController.ts feat: add TUI session orchestrator 2026-05-26 20:51:59 -07:00
turnStore.ts chore(tui): remove dead branch cleanup code 2026-04-26 21:54:24 -05:00
uiStore.ts feat: add TUI session orchestrator 2026-05-26 20:51:59 -07:00
useComposerState.ts fix(cli): restore fallback paste collapse + handle long single-line pastes (#32447) 2026-05-25 23:49:01 -07:00
useConfigSync.ts fix(cli): restore fallback paste collapse + handle long single-line pastes (#32447) 2026-05-25 23:49:01 -07:00
useInputHandlers.ts feat(tui): single /model command + unified Sessions overlay (#37112) 2026-06-01 22:28:36 -04:00
useLongRunToolCharms.ts chore(tui): clean live progress lint 2026-04-26 15:42:07 -05:00
useMainApp.ts fix(tui): persist timed-out/cancelled clarify prompts in transcript 2026-06-04 16:25:54 -07:00
useSessionLifecycle.ts fix(tui): reuse live session on resume 2026-06-04 08:18:26 -07:00
useSubmission.ts fix(tui): always call input.detect_drop for reliable image attachment 2026-04-30 20:25:52 -07:00