Skip to content

[Bug] Shift+Enter submits instead of newline in Pi after running a tool (Windows + Git Bash) — Pi missing windowsShiftEnterEncoding #9703

Closed

Description

@itisvincent

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

Steps to reproduce

  1. Launch Pi in an Orca agent pane (Git Bash as the shell).
  2. At the prompt, press Shift+Enter → inserts a newline ✅
  3. Let Pi run any tool that spawns a subprocess (e.g. a bash/read/edit tool).
  4. Back at Pi's prompt, press Shift+Enter → submits ❌
  5. 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)

  1. 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.
  2. 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.
  3. 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

Activity

  1. added theissue type on Jul 21, 2026
  2. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    Repro (code-path) — confirmed

    Config gap

    In src/shared/tui-agent-config.ts:

    • droid sets windowsShiftEnterEncoding: 'csi-u'
    • pi does not (also missing on most other agents; only droid has the trusted Windows path)

    Routing

    resolveWindowsShiftEnterEncoding (terminal-windows-shift-enter.ts) returns:

    TUI_AGENT_CONFIG[agent].windowsShiftEnterEncoding ?? 'alt-enter'

    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.ts only prefers CSI-u when windowsShiftEnterEncoding === '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.

  3. added
    has_reproConclusive reproduction exists (test/script/CLI evidence). See docs/bug-reproductions/
    on Jul 27, 2026
  4. itisvincent commented on Jul 28, 2026

    @itisvincent
    ContributorAuthor

    @nwparker could i know when will merge my fix thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghas_reproConclusive reproduction exists (test/script/CLI evidence). See docs/bug-reproductions/os:Windows

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions