Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Space key produces repeated/duplicate input in V3 TUI prompt (2.21.2)

Open muzigan opened this issue 2 months ago • 3 comments

Before opening, please confirm:

Operating System

kiro-cli 2.21.2, VS Code integrated terminal, WSL2 Ubuntu 24.04

Kiro Version

2.21.2

Bug Description

After upgrading to V3, a single Space press in the TUI prompt inserts multiple spaces (e.g. "spacespacespace"). Not reproducible in classic mode (kiro-cli --classic), in a plain shell, or with a different input method (tested Chinese and English IME). Isolated to the V3 TUI prompt.

Suspected cause: The "hold Space = push-to-talk" binding in the V3 TUI prompt bar seems to fire on normal single Space keypresses. There is no documented setting to disable Space push-to-talk.

Repro:

  1. Launch V3 TUI (default kiro-cli)
  2. Press Space once in the prompt
  3. Multiple spaces get inserted

Workaround: kiro-cli --classic (Space behaves normally).

Steps to Reproduce

Description: After upgrading to V3, a single Space press in the TUI prompt inserts multiple spaces (e.g. "spacespacespace"). Not reproducible in classic mode (kiro-cli --classic), in a plain shell, or with a different input method (tested Chinese and English IME). Isolated to the V3 TUI prompt.

Suspected cause: The "hold Space = push-to-talk" binding in the V3 TUI prompt bar seems to fire on normal single Space keypresses. There is no documented setting to disable Space push-to-talk.

Repro:

  1. Launch V3 TUI (default kiro-cli)
  2. Press Space once in the prompt
  3. Multiple spaces get inserted

Workaround: kiro-cli --classic (Space behaves normally).

Expected: A single Space press inserts one space; push-to-talk should require a real hold, not fire on normal typing.

Expected Behavior

A single Space press inserts one space; push-to-talk should require a real hold, not fire on normal typing.

Conversation ID

No response

Additional Context

No response

muzigan avatar Sep 09 '26 03:09 muzigan

Thanks for opening this issue and providing such a detailed write-up, including the workaround! 🙏 It sounds like the V3 TUI prompt's Space key handling (possibly related to the push-to-talk binding) is causing duplicate space input on single keypresses in WSL2. A maintainer will take a look at this shortly — we really appreciate you isolating the behavior and sharing clear repro steps!

github-actions[bot] avatar Sep 09 '26 03:09 github-actions[bot]

Thanks @muzigan for isolating this to WSL2 + VS Code integrated terminal. The V3 TUI intercepts the space key when the prompt is empty to support push-to-talk voice recording, and it uses a release detection timer to distinguish a quick press from a hold. On WSL2 with the VS Code terminal, key-repeat events arrive at a different rate than the OS keyboard repeat, which can interfere with the timer logic and cause duplicate spaces. This is a first sighting on CLI 2.21.2.

Marking this as a bug to investigate further.

AnilMaktala avatar Sep 09 '26 17:09 AnilMaktala

@AnilMaktala I'm hitting this too, and some testing on my end points away from the push-to-talk timer.

My setup: kiro-cli 2.24.1 in the VS Code 1.111.0 integrated terminal, running in a Linux dev container on a Windows host. Same symptom and same --classic workaround as the original reporter. For me it's a one-for-one substitution rather than duplication: each Space press inserts the literal text space once, so two presses give spacespace. Holding Space just auto-repeats space like a letter key, and no recording ever starts. Setting KIRO_VOICE_SUPPORTED=0 doesn't change anything, which I'd expect it to if push-to-talk were involved.

What does seem to explain it is the Kitty keyboard protocol. I captured the raw bytes with a small script (below) that sends the same probe and mode switches the TUI does, run in both terminals against the same container:

VS Code Windows Terminal
Reply to the ESC[?u probe ESC[?0u none (only the device-attributes reply to ESC[c)
Space after ESC[>1u ESC[32u ' '
Space under modifyOtherKeys (ESC[>4;1m) ' ' ' '

So VS Code answers the probe, the TUI turns the protocol on, and VS Code then sends an unmodified Space as ESC[32u. The TUI appears to decode that to the key name space and insert the name instead of " ". Windows Terminal never answers the probe, so the protocol stays off, and Space works fine there.

Capture script, if you want to reproduce it

Run it in a bash shell inside the terminal you want to test (not inside kiro-cli), and press Space once at each prompt. Each prompt waits 5 seconds. It restores the terminal mode when it finishes.

python3 - <<'EOF'
import tty, termios, os, select
fd = os.open('/dev/tty', os.O_RDWR); old = termios.tcgetattr(fd); tty.setraw(fd)
def rd(t):
    b = b''
    while select.select([fd], [], [], t)[0]:
        b += os.read(fd, 64); t = 0.2
    return b
try:
    os.write(fd, b'\x1b[?u\x1b[c'); q = rd(0.5)
    os.write(fd, b'\x1b[>1u\r\nPress SPACE once (kitty mode)\r\n'); k = rd(5)
    os.write(fd, b'\x1b[<u')
    os.write(fd, b'\x1b[>4;1mPress SPACE once (modifyOtherKeys mode)\r\n'); m = rd(5)
    os.write(fd, b'\x1b[>4;0m')
finally:
    termios.tcsetattr(fd, termios.TCSADRAIN, old); os.close(fd)
print("probe reply:           ", q)
print("space, kitty mode:     ", k)
print("space, modifyOtherKeys:", m)
EOF

My output in VS Code:

probe reply:            b'\x1b[?0u\x1b[?1;2c'
space, kitty mode:      b'\x1b[32u'
space, modifyOtherKeys: b' '

And in Windows Terminal:

probe reply:            b'\x1b[?61;4;6;7;14;21;22;23;24;28;32;42;52c'
space, kitty mode:      b' '
space, modifyOtherKeys: b' '

This also looks like the same root cause as #11002, where Shift+Space inserts nothing: there it's CSI 32;2u from Ghostty, here it's ESC[32u from VS Code, and both are Kitty encodings of Space the TUI isn't turning back into a space character.

Roboyette avatar Sep 26 '26 10:09 Roboyette