Skip to content

[BUG] Chat view stops following the tail when the tool-approval box opens #1286

Closed

Description

@edenreich

Summary

In the chat TUI, when the tool-approval box opens, the conversation stops following the tail. The latest content (the prompt that triggered the approval, then the tool results and the final assistant reply after approval) stays hidden below the viewport until the user presses PageDown.

Likely root cause: ConversationView.SetHeight (internal/presentation/tui/components/conversation_view.go) calls Viewport.SetHeight before rebuild(). updateViewportContentFull decides whether to re-pin to the bottom with atBottom := cv.Viewport.AtBottom(), but that check runs after the viewport has already shrunk to make room for the approval box. At the smaller height the old YOffset is below the new maximum offset, so AtBottom() returns false, GotoBottom() is skipped, and follow mode is lost for the rest of the turn. The fix is probably to read AtBottom() before resizing and re-pin afterwards.

Pre-existing: reproduced identically on main and on refactor/domain-boundaries.

Steps to Reproduce

  1. Save this as scenarios.yaml:

    fallback:
      content: "Done."
    scenarios:
      - name: first
        match: '(?i)first'
        turns:
          - tool_calls:
              - { name: Bash, args: { command: "ls" } }
          - content: "FIRST-DONE"
      - name: multi
        match: '(?i)multi test'
        turns:
          - tool_calls:
              - { name: Write, args: { file_path: "m1.txt", content: "one\n" } }
              - { name: Read, args: { file_path: "m1.txt" } }
              - { name: Write, args: { file_path: "m2.txt", content: "two\n" } }
          - content: "MULTI-DONE"
  2. Run INFER_GATEWAY_MOCK=true INFER_GATEWAY_MOCK_SCENARIOS=scenarios.yaml INFER_AGENT_MODEL=mock/openai/gpt-4o infer chat in a terminal of about 50 rows.

  3. Send first a few times so the conversation is taller than the viewport.

  4. Send multi test, then approve both Write prompts with Enter.

Expected Behavior

While the approval box is open, the conversation stays pinned to the bottom, so the > You: multi test line and the queued tool call are visible above the box. After the last approval, the view follows the new output down to MULTI-DONE, as it does for turns that need no approval.

Actual Behavior

  • While the approval box is open, the bottom of the conversation is hidden behind it (the last visible line is the reply from the previous turn).
  • After approving, the view stays scrolled up: it ends partway through the Read result, and the m2.txt Write result and MULTI-DONE are only visible after pressing PageDown.
  • The files are written correctly, so only the viewport is affected.

Activity

  1. added
    bug
    on Sep 23, 2026
  2. added theissue type on Sep 23, 2026
  3. moved this to Todo in 2026on Sep 23, 2026
  4. inference-gateway-releaser commented on Sep 23, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.207.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions