Skip to content

Terminal leaks OSC 11 + DA1 query responses into shell input after foreground process exits (reproducible with delta as git pager) #4041

@viddo

Description

@viddo

Summary

In a Superset terminal pane, running git diff with delta as the git pager leaves stray characters at the next shell prompt, like:

11;rgb:1515/1111/101062;4;9;22c

These are terminal capability responses (background color and device attributes) that delta asks for on startup. Superset isn't fully consuming them, so they leak into the shell as if typed. The same delta setup works correctly in iTerm2 on the same machine, so this looks like a Superset terminal bug rather than a delta one.

Relationship to #4013

#4013 (filed recently by @wesm) reports the same family of bug, with the same 1515/1111/1010 background-color values. Likely the same root cause. Filing this as a separate issue rather than a comment because the user-visible symptoms differ enough to track independently:

  • Terminal duplicates CSI 6n response after OSC 11 query #4013 uses a synthetic Go program that reads the responses correctly but observes the cursor-position response being duplicated on the wire.
  • This issue is a real-world trigger (delta + git diff) where the responses leak past the foreground process entirely and land at the shell prompt as input.
  • DA1 angle is new. Terminal duplicates CSI 6n response after OSC 11 query #4013 covers OSC 11 + CSI 6n. The leak here shows OSC 11 + DA1 (ESC[?62;4;9;22c) running together, which suggests the bug isn't specific to CSI 6n — it's any response following an OSC 11 in the same probe burst.

If they share a fix, great. If not, both surfaces are tracked.

Steps to reproduce

  1. Install delta: brew install git-delta
  2. In ~/.gitconfig:
    [core]
        pager = delta
  3. Open a Superset terminal pane, cd into any git repo
  4. Run git diff — leak appears at the next prompt
  5. Run git diff HEAD~1..HEAD (or any range with output) — leak appears on the command line below the diff output, blocking the next prompt from rendering cleanly

The bug shows up whether or not the diff has content. The trigger is delta starting up and querying the terminal, not the diff itself.

For a self-contained repro without delta, see the Go program in #4013.

What the leaked text means

11;rgb:1515/1111/101062;4;9;22c
  • 11;rgb:1515/1111/1010 — the terminal's reply to delta's "what's your background color?" query (OSC 11). The leading escape character was consumed; the payload was not.
  • 62;4;9;22c — the terminal's reply to delta's "what device are you?" query (DA1, normally ESC[?62;4;9;22c). Same shape: prefix consumed, payload leaked.

Delta sends both queries back-to-back at startup to pick a light/dark theme and color mode.

Expected

No stray text at the prompt. The replies should be consumed before control returns to the shell.

Actual

Reply payloads land at the shell prompt as if typed.

Environment

  • Superset 1.8.0 (also seen in earlier versions, at least a week back)
  • macOS 26.3.1 (Apple Silicon)
  • TERM=xterm-256color, COLORTERM=truecolor
  • SUPERSET_HOOK_VERSION=2
  • Shell: zsh
  • Repro tools: delta 0.18.2, git 2.53.0
  • Does not reproduce in iTerm2 or kitty on the same machine with the same config.

Related

Delta has had its own OSC 11 quirks historically (dandavison/delta#1707, dandavison/delta#1735), both fixed upstream. Current delta works correctly outside Superset on the same machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions