Skip to content

Run command output contains raw escape sequences (e.g. [?9001h) #53

@AThraen

Description

@AThraen

This was generated by AI during triage.

Summary

The run-command output drawer sometimes shows raw terminal escape sequences such as [?9001h instead of stripping them, making the output hard to read.

What is [?9001h?

ESC[?9001h is the Win32 input mode private sequence emitted by ConPTY on initialisation. It signals that the terminal supports the extended Win32 input protocol. It is a PTY bootstrap artefact and carries no meaningful output content.

Reproduction

  1. Create a run command on any session (e.g. dotnet build).
  2. Run it via the ▶ toolbar button.
  3. Open the output drawer — the first line or two may contain [?9001h or similar CSI/DCS sequences.

Root cause (likely)

SessionRunner captures PTY output to an ANSI-stripped string buffer via a simple regex strip. The strip pattern in OutputIndexer (used for FTS indexing) may be more complete than whatever stripping is applied in SessionRunner's capture path. ConPTY emits ESC[?9001h before the child process writes anything, so it lands at the very top of the buffer.

Relevant code path: SessionRunnerRunInstance → raw PTY read loop → string buffer.

Expected behaviour

All escape/control sequences are stripped before the output is stored in the buffer and displayed in the drawer. The drawer shows only plain text.

Suggested fix

Reuse or extract the same ANSI-strip regex already used in OutputIndexer and apply it in RunInstance's capture loop. Also explicitly strip ESC[?9001h and other ConPTY init sequences (ESC[?9000h, ESC[?9002h, ESC]0;…ESC\, etc.) if the general regex doesn't already cover them.

Metadata

Metadata

Assignees

No one assigned

    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