Repository navigation
fix(terminal): keep Pi Shift+Enter newline through detection gaps - #12618
Conversation
📝 WalkthroughWalkthroughWindows Shift+Enter encoding resolution now accepts the active pane’s runtime title. Committed agent titles can select CSI-u encoding when trusted process evidence is unavailable. Trusted process and shell evidence remain authoritative. Revoked foreground-agent routing blocks title-based selection until reconfirmation. Foreground-agent state updates now track 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/store/slices/pane-foreground-agent.test.ts (1)
31-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the stored revocation value.
The current assertion proves only that Zustand created a new mapping object. It does not prove that
routingRevoked: truewas stored.Proposed test assertion
expect(store.getState().paneForegroundAgentByPaneKey).not.toBe(first) + expect( + store.getState().paneForegroundAgentByPaneKey['tab-1:leaf-1'].routingRevoked + ).toBe(true)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 186e6390-0a5b-48b0-aaf5-a7dd6254c4fe
📥 Commits
Reviewing files that changed from the base of the PR and between 5ed4573 and 732cccf340203a07d9765c4b458bf6d7e36a819d.
📒 Files selected for processing (7)
src/renderer/src/components/terminal-pane/keyboard-handlers.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/terminal-windows-shift-enter.test.tssrc/renderer/src/components/terminal-pane/terminal-windows-shift-enter.tssrc/renderer/src/store/slices/pane-foreground-agent.test.tssrc/renderer/src/store/slices/pane-foreground-agent.ts
732cccf to
fdfea21
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Addressed in fdfea21: the test now asserts the stored routingRevoked value directly. I also tightened the title fallback to local Windows ConPTY only after re-auditing SSH/remote title retirement, and updated the PR body with the required template, AI review, security audit, screenshots, ELI5, and proof sections. |
Follow-up: universal Shift+Enter compatibility auditConclusionI recommend keeping this PR's capability/evidence-based routing unchanged. I do not recommend replacing it with one universal Shift+Enter byte sequence. One correction to the original analysis: CSI-u is not Pi's only state-independent representation. Pi also accepts xterm The current abstraction remains the right one: Pi and Droid declare their Windows CSI-u requirement through ELI5There is no single universal "Shift+Enter" code for terminal apps. It is more like several electrical plug shapes: Pi understands two of them, Codex understands a different overlapping set, and some older apps mistake the modern one for text or ignore it. Orca therefore has to choose the plug that the active program has proven it understands. Reference implementation findings
The mature implementations do not converge on one byte sequence; they negotiate, expose mappings, or add application/shell-specific integration. ProofRuntime check against
The same ordering was checked in Pi TUI 0.81.1: CSI-u and Current Codex uses its pinned Crossterm parser for Unix VT input. A sequence ending in Therefore every proposed universal encoding has a demonstrated incompatibility:
No code follow-up is recommended from this audit. |
|
thanks for reporting. looking into it |
…2618) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Summary
ELI5
Orca already knew the right "newline" code for Pi, but it only used it while a short-lived process check said "this is definitely Pi." Tool runs and restarts can briefly hide Pi from that check, so Orca sent Pi the old Enter-like code and Pi submitted the message.
Now, during only that blind spot, Orca can also read the active pane's explicit "Pi" nameplate and keep sending the newline code. A real process check, a confirmed shell, or an explicit "stop trusting this pane" signal still wins, so ordinary shells and other agents keep their previous behavior.
Why this preserves both behaviors
C:\work\pi-project.Screenshots
No visual change.
Testing
pnpm lint— required static analysis CI passed every lint, freshness, localization, reliability, and max-lines stage.pnpm typecheckpnpm test— all 32 Node 24/26 test shards passed in required PR CI; the focused local suite passed 627/627.pnpm build— Linux and Windows package jobs passed, including packaged CLI smoke tests.Proof
Red/green regression:
csi-u, receivedalt-enter.Commands:
pnpm exec vitest run --config config/vitest.config.ts ...terminal-windows-shift-enter.test.ts ...keyboard-handlers.test.ts ...terminal-shortcut-policy.test.ts ...pane-agent-evidence.test.ts ...pane-foreground-agent.test.ts ...pty-connection.test.ts— 627 passed after the final SSH/local boundary change.pnpm run typecheck— node, CLI, and web typechecks pass.git diff --check— pass.pnpm run check:max-lines-ratchet— pass; no new bypasses.pnpm run check:reliability-gates— 66 gates pass.fdfea2182d.AI Review Report
Reviewed the regression against merged PR #11769 and closed PR #12299, then traced process trust, OSC titles, restored panes, no-OSC Git Bash/cmd lifecycle, split ownership, IME shortcut dispatch, and local/remote transports.
Main findings and actions:
routingRevokedand precedence tests.routingRevokedis stored, not just that Zustand replaces the map; added the direct value assertion.Security Audit
Terminal OSC titles are untrusted process output. The fallback therefore:
No follow-up security work is required for this change.
Notes
sendInputImmediatechange is intentionally out of scope: local IPC already drains in the same turn, while changing remote batching would broaden ordering/performance risk without fixing the incorrect-byte root cause.Closes #12541