Skip to content

[Bug]: prompt duplicates in scrollback during live-to-static transition in inline mode #1174

Description

@Rudra2637

Description

In default inline mode (non-alt-screen), submitted user prompts duplicate in the terminal scrollback history when the AI model begins streaming its response.

Holding the submitted message in a live recallable draft causes the prompt to first render in Ink's dynamic live region. When the model starts streaming and the recall window closes, moving the message into Ink's permanent <Static> transcript causes Ink to reprint the prompt to standard output, leaving a duplicate copy of the user's prompt in the scrollback buffer.

Environment

  • OS: Windows 11 (also reproducible across macOS / Linux)
  • Node version: v22.x
  • Nanocoder version: 1.30.0
  • Provider: Ollama (or any provider with latency before first stream chunk)
  • Model: qwen2.5 (or any model)

Steps to Reproduce

  1. Start Nanocoder in default inline mode:
    pnpm run start
    # or
    nanocoder
  2. Type a prompt (e.g., hello can u tell me what is capital of india) and hit Enter.
  3. While the model is processing/generating the first token, observe the prompt rendered in the dynamic live region.
  4. As soon as the first stream chunk arrives and the recall draft state transitions to static history, observe that Ink prints the prompt a second time into the terminal scrollback.

Expected Behavior

The submitted prompt should only appear once in the terminal transcript.

Actual Behavior

The user prompt appears twice in the terminal history:

##Screenshot

Image

Additional Context

  • I have searched existing issues to ensure this is not a duplicate
  • I can reproduce this issue consistently
  • This issue occurs with the latest version of nanocoder
  • The issue does not happen in fullscreen mode (--alt-screen) because <Static> is disabled (disableStatic: true) and rendering is handled within a virtual viewport.
  • The root cause is renderLastQueuedComponentLive moving the prompt component from dynamic flow to <Static> in inline mode. Gating renderLastQueuedComponentLive behind fullscreen mode resolves the duplicate print cleanly.
  • I have prepared a fix and unit tests ready to submit in a PR.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions