Skip to content

Avoid duplicate settled messages when toggling reasoning visibility #31

Open

Description

@TaewoooPark

Problem

Toggling reasoning visibility with Tab can append already displayed user messages to the transcript again. This was reproduced on main 9fb0d50 (0.3.3) and PR #29's original head ccf79b4, so it is an existing issue rather than a regression from the unchanged-footer optimization.

Reproduction

  1. Start an interactive CLI in a visible 80×24 terminal.
  2. Submit a prompt such as CASE_REASONING and keep the response in the reasoning-stream phase (a local SSE fixture with explicit reasoning_content works).
  3. Press Tab to show reasoning, then toggle again.
  4. Inspect the user transcript and scrollback.

Actual: the already printed > CASE_REASONING appears again. Expected: the reasoning view changes without appending another copy of previously committed user messages.

Observed with xterm.js 6.0.0 connected to a real macOS PTY running each built CLI. This does not depend on a real model or credential.

Investigation and scope

Start with Screen.toggleThinking() in packages/tui/src/screen.ts: it resets CommitTracker and calls the ordinary append-oriented paint path. Review how a visible transcript rebuild differs from new transcript emission. toggleVerbose() and setCwd() use related paths and deserve focused regression checks, but duplication in those paths has not yet been independently confirmed.

This differs from #28: #28 concerns live footer rows entering scrollback; this concerns previously settled transcript being emitted again after a display option changes. Keep the terminal's existing main-screen behavior and avoid an unrelated renderer rewrite.

Acceptance criteria

  • Repeated show/hide reasoning toggles do not append duplicate settled user/assistant messages.
  • Reasoning can still be revealed and hidden, both during streaming and after completion.
  • Newly settled messages are committed exactly once after a toggle; redraw preserves composer text and cursor.
  • Regression tests distinguish rebuilding visible content from appending new scrollback, and visible PTY-backed terminal checks cover repeated toggles with a populated transcript.

Please propose a focused correction with tests; this is not tagged as a good first issue because it touches transcript/scrollback ownership.

Activity

  1. added
    bugSomething isn't working
    help wantedExtra attention is needed
    priority:P2Functional reliability or usability improvement
    area:uxUser-facing interaction and diagnostics
    on Sep 22, 2026
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

    area:uxUser-facing interaction and diagnosticsbugSomething isn't workinghelp wantedExtra attention is neededpriority:P2Functional reliability or usability improvement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions