Repository navigation
fix(terminal): preserve Ctrl+Shift chords for direct OMP launches - #17082
CodeHourra wants to merge 1 commit into
Conversation
Greptile SummaryThis PR propagates xterm’s Kitty keyboard capability into bounded PTY startup-query handling so directly launched agents can negotiate modified keys.
Confidence Score: 4/5The remote OMP launch path needs correction before merging because host-authority creation drops the capability required for the advertised Ctrl+Shift fix. Local and legacy terminal creation carry the new capability correctly, but current remote runtimes commonly select agent-session host authority, whose request and runtime creation chain omit the field and therefore leave OMP’s startup query unanswered. Files Needing Attention: src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts and the agent-session RPC/runtime creation path
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts | Adds capability forwarding to legacy remote creates but omits it from the host-authority agent-session requests used by direct OMP launches. |
| src/shared/pty-startup-query-processor.ts | Extracts startup query parsing and adds bounded, one-shot Kitty status handling while retaining color and ConPTY behavior. |
| src/shared/pty-startup-ingress-intent.ts | Makes color replies optional and validates an additive Kitty capability while preserving bounded deadlines. |
| src/main/ipc/terminal-startup-color-query-replies.ts | Builds startup ingress intent for recognized agents when either valid colors or Kitty support are available. |
| src/main/runtime/orca-runtime.ts | Threads the capability from ordinary terminal-create options into PTY spawn, but agent-session creation does not supply it. |
Sequence Diagram
sequenceDiagram
participant X as Renderer xterm
participant T as Remote PTY transport
participant R as Runtime RPC
participant S as PTY startup ingress
X->>T: "Kitty capability + launchAgent=omp"
alt Legacy terminal.create
T->>R: terminal.create(capability)
R->>S: spawn(capability)
S-->>S: Answer CSI ? u
else Host-authority agent session
T->>R: terminal.createAgentSession()
Note over T,R: Capability is dropped
R->>S: spawn without capability
Note over S: CSI ? u remains unanswered
end
Reviews (1): Last reviewed commit: "fix(terminal): advertise Kitty keyboard ..." | Re-trigger Greptile
| ...(launchTokenToSend !== undefined ? { launchToken: launchTokenToSend } : {}), | ||
| ...(launchAgentToSend !== undefined ? { launchAgent: launchAgentToSend } : {}), | ||
| ...(terminalColorQueryReplies ? { terminalColorQueryReplies } : {}), | ||
| ...(terminalKittyKeyboardAdvertised ? { terminalKittyKeyboardAdvertised: true } : {}), |
There was a problem hiding this comment.
Host-authority drops Kitty capability
When a direct remote OMP launch uses agent-session.host-authority.v1, this capability is included only in the legacy terminal.create parameters and is omitted from terminal.createAgentSession, so startup ingress leaves CSI ? u unanswered and Ctrl+Shift chords remain indistinguishable.
Knowledge Base Used:
📝 WalkthroughWalkthroughThe change adds Merge Risk: 🟡 Moderate · up to Remote OMP launches may still fail to distinguish Ctrl+Shift if agent-session creation does not forward the terminal capability, and Windows may continue answering Kitty queries after startup ownership handoff. The PR is not merge-ready until these bounded risks are resolved or explicitly accepted. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description follows the repository template and explains the change, reason, linked issue, protocol behavior, testing, review considerations, and checklist status. It also explains why aggregate checks remain unchecked. Full details: Docstring CoverageExplanation Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 19 files. (1 skipped: 1 too large.)
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ead9c9f7-fd7e-404d-ae30-cb922f360db5
📒 Files selected for processing (20)
src/main/ipc/pty/ipc/spawn-options.tssrc/main/ipc/pty/ipc/spawn-types.tssrc/main/ipc/pty/runtime/spawn-options.tssrc/main/ipc/terminal-startup-color-query-replies.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/terminal/terminal-lifecycle-methods.tssrc/main/runtime/rpc/methods/terminal/unary-schemas.tssrc/preload/api/pty-api.tssrc/preload/index.tssrc/renderer/src/components/terminal-pane/ipc-pty-spawn-request.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/pty-transport-connect-spawn.test.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/shared/pty-startup-ingress-intent.tssrc/shared/pty-startup-ingress.test.tssrc/shared/pty-startup-ingress.tssrc/shared/pty-startup-query-processor.tssrc/shared/terminal-kitty-keyboard-query.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| ...(launchTokenToSend !== undefined ? { launchToken: launchTokenToSend } : {}), | ||
| ...(launchAgentToSend !== undefined ? { launchAgent: launchAgentToSend } : {}), | ||
| ...(terminalColorQueryReplies ? { terminalColorQueryReplies } : {}), | ||
| ...(terminalKittyKeyboardAdvertised ? { terminalKittyKeyboardAdvertised: true } : {}), |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
rg -n -C 12 \
'runRemoteAgentSessionLaunch|terminal\.ensureAgentSession|terminal\.createAgentSession|terminalKittyKeyboardAdvertised' \
srcRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/stablyai/orca-89dc44e4 -type f -name '*.md' -maxdepth 3 -print \
| sort \
| while IFS= read -r f; do
printf '\n### %s\n' "$f"
head -80 "$f"
done
printf '%s\n' '--- remote transport option capture and final payload ---'
sed -n '120,170p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
sed -n '2010,2060p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
printf '%s\n' '--- session creation branch ---'
sed -n '285,410p' src/renderer/src/runtime/web-runtime-session.ts
printf '%s\n' '--- relevant type and contract declarations ---'
rg -n -C 8 \
'terminalKittyKeyboardAdvertised|ensureAgentSession|createAgentSession|RuntimeEnsureAgentSession|RuntimeCreateAgentSession|AgentSession.*Params|AgentSession.*Request' \
src/renderer/src src/shared src/mainRepository: stablyai/orca
Length of output: 285
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- scoped repository guidance ---'
find /tmp/coderabbit-repo-knowledge/stablyai/orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print \
| sort \
| while IFS= read -r f; do
printf '\n### %s\n' "$f"
head -80 "$f"
done
printf '%s\n' '--- remote transport option and payload ---'
sed -n '135,165p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
sed -n '2025,2055p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
printf '%s\n' '--- host-authority request construction ---'
sed -n '300,405p' src/renderer/src/runtime/web-runtime-session.ts
printf '%s\n' '--- exact symbol declarations and consumers ---'
rg -n -C 10 \
'terminalKittyKeyboardAdvertised|terminal\.ensureAgentSession|terminal\.createAgentSession|terminal\.create|RuntimeEnsureAgentSession|RuntimeCreateAgentSession' \
src/renderer/src/runtime src/renderer/src/components/terminal-pane src/preload src/mainRepository: stablyai/orca
Length of output: 275
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- scoped repository guidance ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print \
| sort \
| while IFS= read -r f; do
printf '\n### %s\n' "$f"
head -80 "$f"
done
printf '%s\n' '--- remote transport option and payload ---'
sed -n '135,165p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
sed -n '2025,2055p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
printf '%s\n' '--- host-authority request construction ---'
sed -n '300,405p' src/renderer/src/runtime/web-runtime-session.ts
printf '%s\n' '--- exact symbol declarations and consumers ---'
rg -n -C 10 \
'terminalKittyKeyboardAdvertised|terminal\.ensureAgentSession|terminal\.createAgentSession|terminal\.create|RuntimeEnsureAgentSession|RuntimeCreateAgentSession' \
src/renderer/src/runtime src/renderer/src/components/terminal-pane src/preload src/mainRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- complete host-authority payloads ---'
sed -n '2068,2145p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
printf '%s\n' '--- connect selection and result handling ---'
sed -n '2145,2245p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
printf '%s\n' '--- startup-query propagation contracts ---'
rg -n -C 12 \
'terminalKittyKeyboardAdvertised|kittyKeyboardAdvertised|terminalColorQueryReplies|PtyStartupIngressIntent|startup.*query|startup.*reply' \
src/main src/renderer/src src/preload \
-g '!*.test.ts'
printf '%s\n' '--- knowledge-tree file names ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print | sortRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- all non-test references to the Kitty flag ---'
rg -n 'terminalKittyKeyboardAdvertised' src \
-g '!*.test.ts' \
-g '!*.spec.ts'
printf '%s\n' '--- runtime spawn option construction ---'
sed -n '30,150p' src/main/ipc/pty/runtime/spawn-options.ts
sed -n '30495,30575p' src/main/runtime/orca-runtime.ts
printf '%s\n' '--- agent-session RPC handlers and create parameter types ---'
rg -n -C 8 \
'createAgentSession|ensureAgentSession|agentSessionCreateOperationId|terminalColorQueryReplies|startupIngress' \
src/main/runtime/rpc/methods/terminal src/main/runtime \
-g '!*.test.ts' \
| head -500Repository: stablyai/orca
Length of output: 41436
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- agent-session request contracts and schemas ---'
rg -n -C 12 \
'type RuntimeEnsureAgentSessionRequest|interface RuntimeEnsureAgentSessionRequest|RuntimeEnsureAgentSessionRequest|EnsureAgentSessionParams|CreateAgentSessionParams|RuntimeCreateAgentSessionRequest|terminalColorQueryReplies|launchPreferences' \
src/shared src/main/runtime/rpc/methods/agent-session.ts \
-g '!*.test.ts' \
| head -700
printf '%s\n' '--- ensureAgentSession implementation ---'
sed -n '30025,30135p' src/main/runtime/orca-runtime.ts
printf '%s\n' '--- createAgentSession implementation and launch call ---'
sed -n '30125,30315p' src/main/runtime/orca-runtime.ts
printf '%s\n' '--- agent-session presentation adapter ---'
sed -n '1,190p' src/main/runtime/rpc/methods/agent-session.tsRepository: stablyai/orca
Length of output: 35584
Propagate terminalKittyKeyboardAdvertised through agent-session creation.
The host-authority branch uses terminal.ensureAgentSession or terminal.createAgentSession, but neither payload carries the flag. Both RPC schemas are strict, and both implementations omit the flag when calling createTerminal. Remote OMP launches can therefore miss the Kitty status reply. Add the field to both request contracts and schemas, forward it through both implementations, and assert the resulting requests and startup ingress.
* fix(omp): answer startup Kitty queries before renderer handoff Forward actual renderer capability through local and remote spawn. Preserve source ranges and following keyboard mode pushes, and retain independent ConPTY color authority. Refs #17081. Secondary review: #17082. Co-authored-by: stevelliu <[email protected]> * test(omp): cover fragmented keyboard modes and ConPTY handoff * fix: preserve keyboard startup intent without terminal colors * fix: negotiate keyboard support for host-authoritative agent launches * fix: keep terminal creation within line budget * fix(omp): negotiate keyboard support for paired web launches * test: remove obsolete message type import after main integration * fix: validate paired launch results and retry incomplete SSH test snapshots * fix(omp): negotiate keyboard support for background paired launches --------- Co-authored-by: stevelliu <[email protected]>
ELI5
OMP asks the terminal whether it supports richer keyboard input before it can tell Ctrl+Shift apart from simpler key presses. Orca already answered that question for a normal terminal, but not early enough when OMP was opened directly from the New Tab menu. This change carries the real terminal capability into the startup path and answers OMP there too.
What Changed
Why
When OMP was launched from New Tab > OMP, it could send its Kitty keyboard status query before the renderer owned terminal-query responses. The startup responder only modeled color queries, so OMP did not receive the capability reply and Ctrl+Shift chords were not distinguishable. Launching OMP manually inside New Terminal did not hit that timing gap.
Linked Issue
Fixes #17081
Visual Proof
N/A — there is no static UI change; this changes the startup terminal protocol exchange.
Protocol behavior:
CSI ? u→ no startup reply → OMP leaves modified-key handling unavailable.CSI ? u→CSI ? 0 u; OMP's subsequent mode-set remains visible to xterm → Ctrl+Shift chords work.Testing
Manual verification:
omp, path remains functional.Automated verification:
62/62focused Vitest tests pass across startup ingress, local PTY forwarding, and remote-runtime forwarding.git diff --checkpass for the changed files.The local aggregate pnpm wrappers stalled before printing their child-step output in this environment. A direct full Vitest run was also attempted; it exposed broad pre-existing/environment-dependent failures in unrelated daemon sockets, network listeners, file watchers, and long-timeout UI tests. No failure was in a changed file or the focused regression suite. PR CI should run the official aggregate gates.
AI Disclosure
OpenAI Codex (GPT-5) was used for investigation, implementation, review, testing, and PR preparation.
Review
CSI ? uis covered and the following mode-set is not consumed.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Author X handle: N/A — the contributor's GitHub profile does not list an X handle.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (official aggregate wrappers/CI pending; focused checks above pass)