Skip to content

fix(tui): stabilize sticky prompts and paste recovery#17237

Merged
OutThisLife merged 5 commits into
mainfrom
bb/tui-paste-watchdog
Apr 29, 2026
Merged

fix(tui): stabilize sticky prompts and paste recovery#17237
OutThisLife merged 5 commits into
mainfrom
bb/tui-paste-watchdog

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Reset the Ink parser when bracketed paste starts but the terminal never sends the paste-end marker, preventing future keystrokes from being swallowed as paste content.
  • Stop rendering an empty Thinking accordion while the TUI is merely busy but no reasoning text has arrived.
  • Keep the latest prompt sticky while the viewport is in live assistant output beyond history, and clear stale sticky state at the real bottom using fresh scroll height.
  • Remove the noisy emoji from the /steer queued acknowledgement.
  • Apply the TUI lint autofix/formatter sweep on this branch.

Test plan

  • npm test -- --run packages/hermes-ink/src/ink/parse-keypress.test.ts src/__tests__/details.test.ts src/__tests__/viewport.test.ts
  • npm test -- --run src/__tests__/viewport.test.ts src/__tests__/viewportStore.test.ts packages/hermes-ink/src/ink/parse-keypress.test.ts src/__tests__/details.test.ts
  • npm test -- --run src/__tests__/createSlashHandler.test.ts
  • npm run fix (completed with warnings only; no errors)
  • npm run type-check

Prevent unterminated bracketed paste input from swallowing future keystrokes, and avoid rendering an empty Thinking panel before reasoning arrives.
@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists labels Apr 29, 2026
Keep the latest prompt sticky while the viewport is in live assistant output beyond history, and clear stale sticky state at the real bottom using fresh scroll height.
Keep the /steer acknowledgement plain text so it reads like the rest of the TUI status copy.
@OutThisLife OutThisLife requested a review from Copilot April 29, 2026 03:16
@OutThisLife OutThisLife changed the title fix(tui): recover from stuck paste mode fix(tui): stabilize sticky prompts and paste recovery Apr 29, 2026
Run the TUI lint autofix and formatter on the PR branch after the sticky prompt and paste recovery changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the TUI/Ink input pipeline and viewport UI behavior by recovering from terminals that enter bracketed paste mode but never send the paste-end marker, and by tightening viewport/thinking rendering edge cases.

Changes:

  • Add a watchdog-driven recovery path for unterminated bracketed paste (flush/reset paste mode so future keystrokes aren’t swallowed).
  • Improve viewport correctness by optionally using a “fresh” Yoga-derived scroll height and by refining sticky prompt boundary logic.
  • Avoid rendering an empty Thinking accordion when the app is busy but no reasoning text is present/streaming.

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui-tui/src/types/hermes-ink.d.ts Updates ScrollBoxHandle typing to include getFreshScrollHeight().
ui-tui/src/lib/viewportStore.ts Uses cached scroll height first, then falls back to fresh scroll height to clear stale non-bottom state.
ui-tui/src/domain/viewport.ts Fixes sticky-prompt calculation for tail/out-of-range viewport positions and row-boundary behavior.
ui-tui/src/components/thinking.tsx Prevents empty “Thinking” UI when merely busy and no reasoning is active/streaming.
ui-tui/src/app/slash/commands/core.ts Adjusts queued steer system message formatting.
ui-tui/src/tests/viewportStore.test.ts Adds coverage for fresh scroll-height behavior clearing stale non-bottom state.
ui-tui/src/tests/viewport.test.ts Adds coverage for sticky prompt behavior at history tail and row-boundary conditions.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Resets IN_PASTE state on flush even if paste buffer is empty (recovery from missing paste-end).
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts New tests covering empty paste, unterminated paste flush, and empty-unterminated paste reset.
ui-tui/packages/hermes-ink/src/ink/components/App.tsx Arms the flush watchdog for IN_PASTE state (not just incomplete escapes) to trigger recovery.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/packages/hermes-ink/src/ink/components/App.tsx
Match the buffered-stdin rearm cadence to IN_PASTE state so large pastes do not spin the normal escape timeout while waiting for readable data to drain.
@OutThisLife OutThisLife merged commit 6e9691f into main Apr 29, 2026
9 of 10 checks passed
@OutThisLife OutThisLife deleted the bb/tui-paste-watchdog branch April 29, 2026 03:22
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…watchdog

fix(tui): stabilize sticky prompts and paste recovery
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
…watchdog

fix(tui): stabilize sticky prompts and paste recovery
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…watchdog

fix(tui): stabilize sticky prompts and paste recovery
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…watchdog

fix(tui): stabilize sticky prompts and paste recovery
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…watchdog

fix(tui): stabilize sticky prompts and paste recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants