Skip to content

fix(filtering): remove terminal output overwritten by control flow (\r and \b) #2230

Closed as not planned

Description

@adam-azarchs

This is a more general case of #624.

It's not uncommon for tools (like ollama, npm, curl, bazel, ninja, cmake...) to emit self-overwriting progress messages like like for example ⠋\b⠙\b⠹\b⠸\b⠼\b⠴\b⠦\b⠧\b⠇\b⠏\b or Downloading... 0%\rDownloading... 1%\rDownloading... 2%\rDownloading... 3%\r. I can't really think of any situation where one would want an LLM to see output intermediate outputs that would be only transiently visible to a human.

\r and \b are the most common cases to handle, but there's also ansi sequences that e.g. ncurses uses, like

  • \e[A (moves up one line)
  • \e[{N}A (e.g., \e[3A moves up 3 lines)
  • \e[B (move down)
  • \e[C (move forward)
  • \e[D (more backward)
  • \e[{row};{col}H (e.g., \e[1;1H moves to the top-left corner)

There's currently functionality to strip out ansi sequences, which is good for color etc, but that's not necessarily the desired behavior here. Implementing this comprehensively would probably end up being equivalent to writing a terminal emulator, particularly with the absolute positioning sequences. That might be tricky to implement, but there are many common cases which only update part or all of the most recent line, which could be handled more easily.

This should be applied before the output is separated into lines (especially if one wishes to eventually deal with multi-line edits). For one thing, \r\n is a completely different animal from \r without the \n (which should also probably be normalized, in general, for the benefit of Windows users who otherwise might find toml matchers failing to detect lines that look like they should be detected). Also perhaps obviously would need to happen before strip_ansi gets applied

Activity

  1. rtk-release-bot commented on Sep 3, 2026

    @rtk-release-bot
    Contributor

    This issue has been automatically marked as stale due to 90 days of inactivity. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet.

  2. rtk-release-bot commented on Sep 14, 2026

    @rtk-release-bot
    Contributor

    Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please open a new issue with up-to-date information. Thank you!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions