Repository navigation
Description
Operating system
Windows
Orca version
No response
Details
Summary
Running Pi (@earendil-works/pi-coding-agent) in Orca's integrated terminal on Windows + Git Bash, Shift+Enter inserts a
newline right after Pi starts and right after refocusing the pane, but it submits the message instead immediately after Pi runs a tool
that spawns a child process (bash/read/edit). It then recovers on the next pane refocus.
The same class of issue was fixed for Droid (#7620 → #7668 / #8948) and Grok (#8385), but Pi was never given the**
** windowsShiftEnterEncoding: 'csi-u' config those fixes introduced, so Pi is left on the flaky live-KKP-flag path.
Environment
- OS: Windows 11
- Shell: Git Bash (MINGW64) — emits no OSC 133 prompt marks
- Terminal: Orca integrated terminal (xterm.js), latest build (includes #1247, #7668, fix(terminal): route Droid Shift+Enter to CSI-u in no-OSC shells (Git Bash) (#7620) #8948, [Bug]: Grok terminal shows literal [13;2u (Shift+Enter CSI-u leak) and long-output garble #8385)
- Agent: Pi (
@earendil-works/pi-coding-agent), latest $TERM_PROGRAM=Orca,TERM=xterm-256color
Steps to reproduce
- Launch Pi in an Orca agent pane (Git Bash as the shell).
- At the prompt, press
Shift+Enter→ inserts a newline ✅ - Let Pi run any tool that spawns a subprocess (e.g. a
bash/read/edittool). - Back at Pi's prompt, press
Shift+Enter→ submits ❌ - Click/refocus the pane, press
Shift+Enter→ inserts a newline again ✅ (until the next tool run)
Root cause
Orca routes Shift+Enter in src/renderer/src/components/terminal-pane/terminal-shortcut-policy.ts (~line 152):
const hasTrustedWindowsCsiU = windowsHost && getWindowsShiftEnterEncoding?.() === 'csi-u'
const canSendCsiU = hasTrustedWindowsCsiU || isKittyKeyboardActivePane?.() === true
return { type: 'sendInput', data: canSendCsiU ? '\x1b[13;2u' : '\x1b\r' }CSI-u (newline) is sent only if either the agent has windowsShiftEnterEncoding: 'csi-u' trusted or the pane has active Kitty-keyboard
negotiation (isKittyKeyboardActivePane).
For Pi, path 1 is closed: in src/shared/tui-agent-config.ts, TUI_AGENT_CONFIG< />'pi'< /> does not set windowsShiftEnterEncoding — only droid
has it (line 228). So on Windows, Pi can only ever get CSI-u via path 2 (isKittyKeyboardActivePane).
Path 2 is the flaky one. isKittyKeyboardActivePane() reads flags from TerminalKittyKeyboardModeTracker
(src/shared/terminal-kitty-keyboard-mode-tracker.ts), which scans PTY output and resets flags to 0 on:
- CSI < u (pop)
- RIS (\x1bc full reset)
- DECSTR (CSI ! p soft reset)
- alternate-screen swaps (DECSET/DECRST 47/1047/1049)
Pi pushes Kitty (CSI > 1u) once at startup (queryAndEnableKittyProtocol in pi-tui terminal.js) and never re-pushes (drainInput, which
pops, is exit-only). During a tool run, something in Pi's re-render/tool path emits one of those reset sequences, the tracker flags drop
to 0 → Orca sends ESC+CR → Pi reads it as plain Enter → submit. On refocus, Orca replays retained history via scanReplay, which re-applies
Pi's startup push idempotently → flags > 0 → Shift+Enter works again. This exactly matches the observed "works after start/refocus, breaks
after a tool run" pattern.
Pi itself is not at fault (pushes once, pops only at exit). Every agent without windowsShiftEnterEncoding (claude, codex, gemini, cursor,
…) is on the same flaky path; Pi is just the most visible because it spawns a child process on every tool call.
Expected
Once a pane's program has advertised the Kitty keyboard protocol, Shift+Enter should keep sending CSI-u for the life of that pane — not
flip on/off with tool-subprocess churn.
Suggested fix (any one, or combination)
- Add windowsShiftEnterEncoding: 'csi-u' to TUI_AGENT_CONFIG< />'pi'< /> (and the other agents currently missing it), and keep routingTrusted
sticky across the foreground churn from tool subprocesses — so path 1 covers Pi reliably. - Or: make TerminalKittyKeyboardModeTracker not drop flags on the sequences Pi emits during tool runs, or re-push/replay KKP when focus
returns to the pane. - Or: have Orca re-probe/re-push KKP on focus return for panes whose app already negotiated it.
Workaround
Ctrl+J — sends 0x0A (distinct from Enter's 0x0D), bound as a newline alias by Pi by default. Works on every terminal regardless of
Kitty/trust state.
References
- #1247 — advertise Kitty keyboard protocol on xterm.js
- #7668 — send CSI-u Shift+Enter to Droid on Windows
- fix(terminal): route Droid Shift+Enter to CSI-u in no-OSC shells (Git Bash) (#7620) #8948 — fix no-OSC shells (Git Bash / cmd) spawn-time latching
- [Bug]: Grok terminal shows literal [13;2u (Shift+Enter CSI-u leak) and long-output garble #8385 — gate CSI-u on active KKP flags (the gating that makes this flaky) + set windowsShiftEnterEncoding for Grok
- Pi terminal-setup notes: Pi pushes Kitty once at startup, Ctrl+J is the default newline alias
Activity
nwparker commentedon Jul 27, 2026
Repro (code-path) — confirmed
Config gap
In
src/shared/tui-agent-config.ts:droidsetswindowsShiftEnterEncoding: 'csi-u'pidoes not (also missing on most other agents; only droid has the trusted Windows path)Routing
resolveWindowsShiftEnterEncoding(terminal-windows-shift-enter.ts) returns:So trusted Pi panes fall back to alt-enter (
\x1b\r), which submits instead of newline when Kitty keyboard flags are cleared mid-tool-run.terminal-shortcut-policy.tsonly prefers CSI-u whenwindowsShiftEnterEncoding === 'csi-u'or live Kitty flags are active — the flaky path described in the issue.Verdict
has_repro — missing
windowsShiftEnterEncoding: 'csi-u'for Pi is present on current main; matches Windows Shift+Enter submit-after-tool behavior.itisvincent commentedon Jul 28, 2026
@nwparker could i know when will merge my fix thanks
fix(terminal): trust Pi CSI-u Shift+Enter on Windows (#9703) (#11769)
fix(terminal): keep Pi Shift+Enter encoding applied across foreground…
fix(terminal): give OMP Pi's Windows Shift+Enter encoding (#16376)
fix(terminal): give OMP Pi's Windows Shift+Enter encoding (stablyai#1…
fix(terminal): give OMP Pi's Windows Shift+Enter encoding (stablyai#1…
fix(terminal): trust Pi CSI-u Shift+Enter on Windows (stablyai#9703) (s…
fix(terminal): give OMP Pi's Windows Shift+Enter encoding (stablyai#1…