Skip to content

fix(omp): answer startup Kitty queries before renderer handoff - #20620

Merged
nwparker merged 11 commits into
mainfrom
nwparker/omp-keyboard-startup
Sep 19, 2026
Merged

nwparker merged 11 commits into
mainfrom
nwparker/omp-keyboard-startup

Conversation

@nwparker

@nwparker nwparker commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​599 $\color{#cf222e}{\Huge{\mathbf{−}}}$​119 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​480
Prod 30 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​302 $\color{#cf222e}{\Huge{\mathbf{−}}}$​118 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​184

OMP can ask about keyboard support before its renderer owns terminal replies. This change forwards the renderer's Kitty capability and answers the first startup query through the existing reply path, preserving subsequent mode changes and output sequence ranges.

Fixes #17081. Compared with contributor #17082; stevelliu is credited as co-author.

Local, SSH, paired New Tab, and paired background launches carry the capability. Strict host-authority agent-session methods receive it only after agent-session.keyboard.v1 negotiation; older hosts retain their original strict payload. Legacy terminal creation accepts the additive field. Paired panes use their default terminal advertisement; native Windows panes retain their existing Kitty-withholding policy. Keyboard-only ingress works without theme colors. Color and keyboard reply ownership remain independent.

Validation

  • Latest head b66102f6478: 145 focused tests passed across background launches, capability negotiation, host-authority creation, legacy fallback, ingress and search coverage. Web typecheck and commit hooks pass.
  • Background regression: two assertions failed before the fix; capable-host, older strict-host, legacy fallback and OMP-specific cases now pass.
  • Earlier native win-lowspec runs passed 62 tests. Existing rendered native Windows, POSIX, SSH and paired New Tab evidence is retained; the new background launch path has contract coverage, not new Windows/rendered proof.
  • Actual OMP ProcessTerminal smoke verified negotiation before renderer attachment, one reply, preserved mode push and contiguous raw output, without a model call. See docs/reference/omp-startup-keyboard-query.md for the redirected, non-TTY invocation.
  • CI35161771688 passed before the background fix. Current-head CI is pending. First-run onboarding can still reset flags to 0; ordinary POSIX/SSH startup flags5 evidence does not claim to fix that separate OMP behavior.

Two intentional CI repairs accompany validation: Docker SSH process observations use bounded retries when a process exits between /proc reads, preserving the complete-snapshot and unchanged-relay assertions; main integration removes one byte-identical duplicate search test that failed the native-quality gate. Neither changes production process cleanup.

nwparker and others added 2 commits September 14, 2026 05:44
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]>
@nwparker
nwparker marked this pull request as ready for review September 14, 2026 12:57
@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The change forwards the renderer's Kitty keyboard capability through local, remote, and agent-session terminal creation. Startup ingress parses and answers the first CSI ? u query, tracks Kitty modes, and preserves color-query handling. Operation fingerprints preserve the negotiated flag across retries. Tests cover parsing, handoff, backends, RPC propagation, and OMP startup. Documentation defines the negotiation contract.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to b6610

Some Windows launches may enable unsupported keyboard handling, while prepared-command and after-tab launches can still miss Kitty startup negotiation. These paths should be corrected before merge.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes changes with no demonstrated connection to Issue #17081. src/shared/text-search.test.ts removes an unrelated Git separator test. tests/e2e/ssh-docker-watcher-isolation.spec.ts chan… Remove the unrelated text-search test deletion and Docker SSH watcher polling changes, or provide a direct coding connection to Issue #17081.
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 41 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the change, motivation, linked issue, implementation scope, and validation. However, it omits most required template sections, including ELI5, What Changed, Why, Visual Proof,… Rewrite the description using the repository template. Add all required section headings and content. Include N/A with a reason under Visual Proof if there is no visual or interaction change. Complete the Testing checkboxes and document t…
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #17081 requires Kitty capability forwarding, one startup CSI ? u reply before renderer handoff, and preservation of later mode-setting sequences. The PR forwards the renderer capability throug…
Title check ✅ Passed The title clearly identifies the primary change: answering OMP startup Kitty queries before renderer handoff.
Full details: Out of Scope Changes check

Explanation

The PR includes changes with no demonstrated connection to Issue #17081. src/shared/text-search.test.ts removes an unrelated Git separator test. tests/e2e/ssh-docker-watcher-isolation.spec.ts changes Docker SSH watcher polling behavior without linking it to Kitty capability forwarding or PTY startup ingress. These changes are outside the linked issue scope.

Full details: Docstring Coverage

Explanation

Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 41 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description explains the change, motivation, linked issue, implementation scope, and validation. However, it omits most required template sections, including ELI5, What Changed, Why, Visual Proof, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Rewrite the description using the repository template. Add all required section headings and content. Include N/A with a reason under Visual Proof if there is no visual or interaction change. Complete the Testing checkboxes and document test commands and platforms. Complete the Agent skill upstream boundary, Notes, and Checklist sections. Add AI Disclosure details if applicable.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 0d0c7b2d-6679-422c-b0bd-575928b1e00f

📥 Commits

Reviewing files that changed from the base of the PR and between 93c3702 and 44ab5aa.

📒 Files selected for processing (24)
  • docs/reference/omp-startup-keyboard-query.md
  • src/main/ipc/pty/ipc/spawn-options.ts
  • src/main/ipc/pty/ipc/spawn-types.ts
  • src/main/ipc/pty/runtime/spawn-options.ts
  • src/main/ipc/pty/runtime/spawn-state.ts
  • src/main/runtime/orca-runtime-create-terminal.ts
  • src/main/runtime/rpc/methods/terminal/terminal-lifecycle-methods.ts
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/main/runtime/runtime-rpc-mobile-terminal-streaming.test.ts
  • src/main/runtime/runtime-terminal-contracts.ts
  • src/preload/api/pty-api.ts
  • src/preload/api/pty-bridge-session-control.ts
  • src/renderer/src/components/terminal-pane/ipc-pty-spawn-request.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/shared/pty-startup-color-query-answer.ts
  • src/shared/pty-startup-ingress-intent.ts
  • src/shared/pty-startup-ingress-kitty.test.ts
  • src/shared/pty-startup-ingress.ts
  • src/shared/pty-startup-query.ts
  • src/shared/rpc-contract/terminal-unary-params.ts
  • tests/tools/omp-startup-keyboard-smoke.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Run the actual OMP protocol smoke with a read-only reference checkout:

```sh
ORCA_BACKGROUND_LAUNCH=1 bun tests/tools/omp-startup-keyboard-smoke.mjs /path/to/oh-my-pi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Redirect stdout in the smoke-test command.

A direct interactive invocation sets process.stdout.isTTY to true. The harness rejects that state before it starts the protocol test. Redirect stdout to a file or a non-TTY stream while preserving the Bun process exit status.

Proposed fix
-ORCA_BACKGROUND_LAUNCH=1 bun tests/tools/omp-startup-keyboard-smoke.mjs /path/to/oh-my-pi
+ORCA_BACKGROUND_LAUNCH=1 bun tests/tools/omp-startup-keyboard-smoke.mjs /path/to/oh-my-pi >/tmp/omp-startup-keyboard.json && cat /tmp/omp-startup-keyboard.json
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ORCA_BACKGROUND_LAUNCH=1 bun tests/tools/omp-startup-keyboard-smoke.mjs /path/to/oh-my-pi
ORCA_BACKGROUND_LAUNCH=1 bun tests/tools/omp-startup-keyboard-smoke.mjs /path/to/oh-my-pi >/tmp/omp-startup-keyboard.json && cat /tmp/omp-startup-keyboard.json

Comment thread src/main/ipc/pty/ipc/spawn-options.ts Outdated
if (startupTerminalColorQueryReplyColors) {
ctx.spawnOptions.startupIngress = {
colors: startupTerminalColorQueryReplyColors,
...(args.terminalKittyKeyboardProtocol === true ? { kittyKeyboardProtocol: true } : {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Allow Kitty-only startup ingress.

getStartupTerminalColorQueryReplyColors(args) returns null when color replies are absent or invalid. Both buildPtyIpcSpawnOptions and buildRuntimePtySpawnOptions create startupIngress only when that result is truthy. Reachable local and runtime spawns with terminalKittyKeyboardProtocol === true therefore create no ingress and cannot answer OMP’s initial ESC[?u query.

Update the startup-ingress contract to allow a Kitty-only intent. Construct startupIngress when Kitty is enabled or valid color replies exist. Skip color-query handling when color replies are unavailable. A condition change alone is insufficient because the current intent parser requires both color replies.

Comment on lines +2227 to +2229
...(terminalKittyKeyboardProtocol === true
? { terminalKittyKeyboardProtocol: true }
: {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Forward the Kitty capability through both structured agent-session creates.

Both renderer payloads omit terminalKittyKeyboardProtocol. The ExplicitEnsure and CreateAgentSessionParams schemas and request types also omit it. Both host methods then call createTerminal without the field. The existing PTY spawn contracts already support the field, but kittyKeyboardProtocol remains unset, so OMP launches on either structured path can miss the Kitty startup-query response.

Add the field to both request contracts and payloads. Pass it through both createTerminal option objects. Do not extend the existing PTY spawn contracts.

@nwparker

Copy link
Copy Markdown
Contributor Author

Risk-reduction review at 44ab5aad45baedc4e899fee562f739c516e6dc1d: Hold — incomplete paths.

Actual OMP protocol smoke passes (177 raw sequence coverage), but Kitty-only ingress parses as undefined and structured session-create paths omit the capability.

Remaining user-facing consequence: Some launches still lose modified-key distinctions. Requires compatible propagation through strict old/new-host schemas and actual launch proof.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The capability reaches terminal.create but not the paired host-authority agent-session create, so the startup Kitty handshake is still missed on that path.

Reviewed changes

Reviewed the full 24-file diff at 44ab5aa: the new Kitty startup-query path in PtyStartupIngress, its intent plumbing across local/SSH/daemon/paired spawn, and the new tests/tooling.

  • Kitty query parser — parsePtyStartupQuery matches only the exact \x1b[?u unit token while authority is open, returns partial for proper prefixes, and delegates to parseTerminalOscColorQuery otherwise; the consumed range removes just the query and preserves surrounding sequence ranges.
  • Ingress state machine — a separate kittyQueryOpen authority, a mirrored TerminalKittyKeyboardModeTracker feeding \x1b[?<flags>u, and pending-candidate release rules for ConPTY vs posix.
  • Color-query extraction — answerQuery's body moved unchanged into pty-startup-color-query-answer.ts; color and Kitty authority now end independently.
  • Capability plumbing — optional terminalKittyKeyboardProtocol threaded from the renderer's xterm option through IPC, daemon, SSH, and the terminal.create RPC schema; wire version and stream opcodes unchanged.
  • Tests/tooling — 13 ingress tests covering fragmentation, ConPTY, deadline, write failure, once-only answering, and authority separation, plus a manual OMP smoke harness and a reference doc.

I verified the new and touched tests pass (pty-startup-ingress-kitty, pty-startup-ingress, runtime-rpc-mobile-terminal-streaming, remote-runtime-pty-transport-create-handoff) and that pnpm tc:node is clean. A byte-level fuzz pass over the ingress found no dropped or duplicated byte and no double answer.

ℹ️ Nitpicks

  • The renderer side of the wiring — pty-input-recovery.ts:38-39 reading session.pane.terminal.options.vtExtensions?.kittyKeyboard — has no test. The transport-level tests pass the flag in directly, so nothing pins the "capability comes from the live xterm option, not a default" contract that makes the native-Windows withhold case work.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this delta — informational only. The previously flagged paired host-authority agent-session path is untouched by this commit and remains the one open item, so this review is non-approving.

Reviewed changes

Reviewed the single new commit 8936204c0b (delta against the prior pullfrog review at 44ab5aa): it lets a Kitty capability arm startup ingress even when theme colors are absent.

  • Intent construction refactored — getStartupTerminalColorQueryReplyColors became getStartupTerminalIngressIntent and now builds the intent through parsePtyStartupIngressIntent, falling back to colors: {} rather than dropping the intent when color replies are missing. A recognized agent with terminalKittyKeyboardProtocol: true but no valid theme colors therefore still answers CSI ? u.
  • Parser relaxed — parsePtyStartupIngressIntent accepts an absent/empty colors when kittyKeyboardProtocol === true. colors and deadlineMs are now read via in-checks on the unknown input instead of an as cast, and the 0–30s deadline bound is unchanged.
  • Both local and runtime spawn-options assign the parsed intent verbatim instead of reconstructing the object inline.
  • Tests — new terminal-startup-color-query-replies.test.ts (5 cases: agent variants keep keyboard startup without colors; ordinary shells/unadvertised support stay off; color-only startup preserved) plus three new kitty-ingress groups for colorless intents, colorless rejection without Kitty, and invalid deadlines.

I verified the touched tests pass (32 tests across terminal-startup-color-query-replies and pty-startup-ingress-kitty) and pnpm tc:node is clean at 8936204c0b. The relaxation does not regress color-only behavior on the wire: terminalOscColorQueryReplies({}, [10, 11]) is still falsy, so an empty-colors intent answers Kitty only and leaves color queries to the existing fallback.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ The previously flagged paired host-authority gap is fixed and the new capability negotiation is well covered. One non-anchored scope question remains about the other renderer agent-session create sites — non-approving only so that stays on the record.

Reviewed changes

Reviewed the single new commit 9b8bf09 (delta against the prior pullfrog review at 8936204): it closes the flagged paired host-authority gap by negotiating a new agent-session.keyboard.v1 capability before sending terminalKittyKeyboardProtocol on terminal.createAgentSession / terminal.ensureAgentSession.

  • Capability negotiation module — createAgentSessionKeyboardOptions probes agent-session.keyboard.v1 once per transport and freezes the payload, so replays keep the original request shape; disabled/absent renderer support never probes; compat-block errors propagate while transient probe failures fall back to the legacy payload.
  • Host-authority params — terminalKittyKeyboardProtocol added to the .strict() CreateAgentSessionParams / EnsureAgentSessionParams schemas and the shared request types; hostAuthorityCreate() spreads the negotiated options into both create and ensure calls.
  • Host forwarding — both host create sites now pass the flag into createTerminal, and the create-operation fingerprint includes it so a changed capability under the same operation id is refused.
  • Tests — new negotiation/freeze/refusal unit tests, a host-support × resume matrix on the transport's params, and create/resume forwarding plus conflict coverage. Verified 41 tests pass locally.

ℹ️ Other paired-host agent-session creates still omit the keyboard flag

The capability now rides remote-runtime-pty-transport.ts, but two other renderer call sites still build terminal.createAgentSession / terminal.ensureAgentSession without terminalKittyKeyboardProtocol: web-runtime-terminal-create-operation.ts:97-145 (web-host agent tabs, reached through launch-agent-web-host-tab.ts) and runtime-agent-background-create.ts:36-57. Their fallbacks (session.tabs.createTerminal / terminal.create) omit it too, so an agent launched through those surfaces still answers no CSI ? u before renderer handoff and keeps the startup race this PR fixes. Is that intentionally out of scope (a follow-up PR), or should the capability ride those RPC params as well? If it is out of scope, a line in docs/reference/omp-startup-keyboard-query.md naming the remaining surfaces would keep the next reader from assuming full coverage.

Technical details
# Keyboard capability not threaded through all paired-host agent-session creates

## Affected sites
- `src/renderer/src/runtime/web-runtime-terminal-create-operation.ts:97-145` — host-authority `terminal.ensureAgentSession` / `terminal.createAgentSession` params carry no `terminalKittyKeyboardProtocol`; the `session.tabs.createTerminal` fallback (`:158-178`) omits it too.
- `src/renderer/src/runtime/web-runtime-session-types.ts:17-43` — `CreateWebRuntimeSessionTerminalArgs` has no kitty field, so the client cannot thread it from the pane's `vtExtensions.kittyKeyboard` without new plumbing.
- `src/renderer/src/lib/launch-agent-web-host-tab.ts:70-95` — builds those args for a paired web host agent tab.
- `src/renderer/src/lib/runtime-agent-background-create.ts:36-78` — same omission on the host-authority path and the `terminal.create` fallback.

## Required outcome
Either (a) the keyboard capability rides every paired-host agent-session create so OMP's first `CSI ? u` is answered on those surfaces too, or (b) the scope boundary is documented so the doc's "local/SSH/paired" claim is accurate.

## Open questions for the human
- Are the web-host and background-agent surfaces expected to hit the same startup race (both answer color queries from host view colors but never kitty)?
- If deliberately deferred, should the capability advertisement/negotiation still be reused there, or is a separate follow-up preferred?

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new critical issues — the paired web host-authority create now negotiates the keyboard capability. One paired surface named in the previous review still omits it.

Reviewed changes

Reviewed the delta since the prior pullfrog review at 9b8bf09 (commit 1b1a7f94): it threads the negotiated keyboard capability into the paired web agent-session create path.

  • Paired web creates negotiate the flag — createWebRuntimeSessionTerminalResult now builds createAgentSessionKeyboardOptions(...) from the default terminal advertisement and spreads the result into both terminal.ensureAgentSession and terminal.createAgentSession.
  • Shared request types widened — optional terminalKittyKeyboardProtocol added to RuntimeEnsureAgentSessionRequest / RuntimeCreateAgentSessionRequest, which until now existed only on the Zod schemas (the host file is @ts-nocheck, so typecheck never caught the divergence).
  • Test matrix extended — the host-authority create test gains a keyboardSupported dimension asserting the param is present only when the host advertises agent-session.keyboard.v1; the harness clears the runtime-compat cache per test, so the dimension genuinely exercises negotiation.

I verified the touched suites pass (web-runtime-session-terminal-host-authority 17, agent-session-keyboard-capability 6, remote-runtime-pty-transport-create-handoff 14) and that pnpm tc:web / pnpm tc:node are clean at 1b1a7f94. Using buildDefaultTerminalOptions() here is consistent with the eventual renderer: the vtExtensions.kittyKeyboard: false withhold is gated on isLocalNativeWindowsConpty, which requires a 'local' execution host, so a paired-remote pane advertises kitty regardless of client OS.

ℹ️ Background paired agent-session creates still omit the keyboard flag

runtime-agent-background-create.ts builds terminal.createAgentSession (and its terminal.create fallback) without terminalKittyKeyboardProtocol, so an agent launched into a paired background/sleeping session still cannot answer OMP's startup CSI ? u before renderer handoff. This is the second of the two surfaces the previous review named; the web-host site is now fixed, but this one is untouched and the reference doc still reads as though every paired client negotiates the capability.

Technical details
# Remaining paired agent-session create omits the keyboard capability

## Affected sites
- `src/renderer/src/lib/runtime-agent-background-create.ts:40` — host-authority `terminal.createAgentSession` params carry no `terminalKittyKeyboardProtocol`; the `terminal.create` fallback at `:61` omits it too.
- `src/renderer/src/lib/launch-agent-background-session.ts:177` — the paired-runtime background launch that reaches that helper.
- `docs/reference/omp-startup-keyboard-query.md:5` — describes clients sending the flag on `terminal.createAgentSession` / `terminal.ensureAgentSession` without noting this deferred surface.

## Required outcome
Either thread the same negotiated capability through this create (reusing `createAgentSessionKeyboardOptions`, mirroring `web-runtime-terminal-create-operation.ts`), or state the deferred surface in the reference doc so its coverage claim is accurate.

## Open question for the human
Is the background/sleeping-agent surface deliberately deferred to a follow-up, or should it ride the same capability negotiation now?

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this delta. The one paired surface flagged previously is still untouched, so this stays non-approving.

Reviewed changes

Reviewed the delta since the prior pullfrog review at 941ce43 (commit abb10a0): it hardens the paired-web launch result handling and edits two SSH e2e files.

  • Paired launch results are now decoded — readCreatedAgentTerminalIdentity validates the terminal coordinates returned by terminal.createAgentSession / terminal.ensureAgentSession before they are consumed in web-runtime-terminal-create-operation.ts, replacing the two as RuntimeRpcResponse<...> casts with a checked decode that keeps only tabId/paneKey.
  • Decoder unit tests added — web-runtime-terminal-identity.test.ts pins acceptance of additive/legacy fields and rejection of malformed shapes.
  • Unrelated SSH e2e rewrites bundled in — ssh-docker-watcher-isolation.spec.ts switches its two expect.poll waits to expect().toPass() retries, and docker-ssh-relay-processes.ts gets a comment tweak.

I verified the touched suites pass (web-runtime-terminal-identity 7, web-runtime-session-terminal-host-authority 17, web-runtime-session-terminal-legacy-create 9, remote-runtime-pty-transport-create-handoff 14, agent-session-keyboard-capability 6), pnpm tc:web and the e2e typecheck are clean, and oxlint is clean on the changed renderer files at abb10a0.

ℹ️ Unrelated SSH e2e retry rewrite rides along

Neither tests/e2e/ssh-docker-watcher-isolation.spec.ts nor tests/e2e/helpers/docker-ssh-relay-processes.ts has any connection to the Kitty startup path. Both edits look reasonable in isolation, but bundling them here makes the PR's scope ambiguous; if they are an intended flakiness fix, a separate PR would be cleaner, and if they were picked up accidentally they should be dropped.

Technical details
# Unrelated test changes included in the Kitty startup commit

## Affected sites
- `tests/e2e/ssh-docker-watcher-isolation.spec.ts:51-55` and `:129-139` — the two `waitForRelayWatcherProcessGroup` / `afterCrash` waits are rewritten from `expect.poll(...).toBe(...)` to `expect(() => { ... expect(...).toBe(...) }).toPass({ timeout })`, and a comment is added about a process exiting between `/proc` reads.
- `tests/e2e/helpers/docker-ssh-relay-processes.ts:55` — the `Number('')` comment is reworded.
- None of these files are touched by the Kitty ingress, capability negotiation, or host-authority changes.

## Required outcome
Either confirm the e2e change is intentional and split it out (or explain why it must ride here), or drop it so the PR's diff stays limited to the OMP startup keyboard fix.

## Open question for the human
Was the SSH e2e retry rewrite meant for this PR, or did it come along from another working tree?

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed commit 5596aade62 and merge b66102f647 against the prior pullfrog review at abb10a0: it closes the last remaining paired-host agent-session create that omitted the keyboard capability, and deduplicates a search test brought in by main.

  • Paired background launches negotiate the keyboard capability — runtime-agent-background-create.ts now builds createAgentSessionKeyboardOptions(...) from the default terminal advertisement and spreads the negotiated result into the host-authority terminal.createAgentSession params, mirroring web-runtime-terminal-create-operation.ts. The non-strict terminal.create fallback carries the additive flag when the renderer advertises it.
  • Capability matrix test added — launch-agent-background-session-remote.test.ts gains an it.each([true, false]) case asserting the param is present only when the host advertises agent-session.keyboard.v1, plus an OMP-launch assertion and a legacy-fallback assertion. The harness clears the runtime-compat cache per test, so the dimension genuinely exercises negotiation.
  • Remaining gap closed in the doc — docs/reference/omp-startup-keyboard-query.md:5 now names the paired background path.
  • Duplicate search test removed on main integration — one byte-identical duplicate of the separator-only include-pattern case is dropped; the surviving case and all its imports remain.

The background helper is reached only when runtimeTarget.kind === 'environment', so using the default kittyKeyboard: true advertisement matches the paired-remote decision already made for the web-host path. Verified locally: launch-agent-background-session-remote (17), agent-session-keyboard-capability (6), and text-search (45) pass, pnpm tc:web is clean, and oxlint reports 0 warnings on the changed files. All prior Pullfrog threads are resolved.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Forward the negotiated keyboard capability… · web-runtime-terminal-create-operation.ts:171-189

src/renderer/src/runtime/web-runtime-terminal-create-operation.ts:171-189
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Forward the negotiated keyboard capability through the legacy launch path.

When args.preparedAgentCommand or args.afterTabId forces mustUseLegacyAgentCreate, the session.tabs.createTerminal request does not call keyboardOptions(environmentId). The CreateTerminalTab schema and its handler also do not declare or forward terminalKittyKeyboardProtocol, so adding the field only in the renderer request would not reach runtime.createMobileSessionTerminal. Extend that legacy contract and forward the field before spreading the capability-gated options. This preserves Kitty keyboard support when the renderer and host advertise AGENT_SESSION_KEYBOARD_RUNTIME_CAPABILITY.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7e5af39d-fe37-4154-adfe-11d779ec2d86

📥 Commits

Reviewing files that changed from the base of the PR and between 9b8bf09 and b66102f.

📒 Files selected for processing (18)
  • docs/reference/omp-startup-keyboard-query.md
  • src/main/ipc/pty/runtime/spawn-options.ts
  • src/main/ipc/pty/runtime/spawn-state.ts
  • src/main/runtime/orca-runtime-create-terminal.ts
  • src/main/runtime/rpc/methods/terminal/terminal-lifecycle-methods.ts
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/main/runtime/runtime-terminal-contracts.ts
  • src/renderer/src/lib/launch-agent-background-session-remote.test.ts
  • src/renderer/src/lib/runtime-agent-background-create.ts
  • src/renderer/src/runtime/web-runtime-session-terminal-host-authority.test.ts
  • src/renderer/src/runtime/web-runtime-terminal-create-operation.ts
  • src/renderer/src/runtime/web-runtime-terminal-identity.test.ts
  • src/renderer/src/runtime/web-runtime-terminal-identity.ts
  • src/shared/protocol-version.ts
  • src/shared/rpc-contract/terminal-unary-params.ts
  • src/shared/text-search.test.ts
  • tests/e2e/helpers/docker-ssh-relay-processes.ts
  • tests/e2e/ssh-docker-watcher-isolation.spec.ts
💤 Files with no reviewable changes (1)
  • src/shared/text-search.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +34 to +35
const keyboardProtocol = buildDefaultTerminalOptions().vtExtensions?.kittyKeyboard
const keyboardOptions = createAgentSessionKeyboardOptions(keyboardProtocol)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,110p' src/renderer/src/lib/runtime-agent-background-create.ts
rg -n "createRuntimeAgentBackgroundTerminal|buildDefaultTerminalOptions|kittyKeyboard|terminalKittyKeyboardProtocol" src/renderer/src/lib src/renderer/src/components/terminal-pane | head -240

Repository: stablyai/orca

Length of output: 22534


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- capability/default definitions ---'
cat -n src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.ts
cat -n src/renderer/src/lib/pane-manager/pane-terminal-options.ts | sed -n '1,95p'
printf '%s\n' '--- background callers and tests ---'
rg -n -A28 -B12 "createRuntimeAgentBackgroundTerminal|launch-agent-background-session" src/renderer/src/lib src/renderer/src/runtime src/renderer/src/components
printf '%s\n' '--- keyboard option helper and downstream launch use ---'
rg -n -A45 -B15 "createAgentSessionKeyboardOptions|terminalKittyKeyboardProtocol" src/renderer/src/runtime src/renderer/src/components/terminal-pane src/renderer/src/lib

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- keyboard protocol gate ---'
sed -n '1,100p' src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.ts
printf '%s\n' '--- default terminal options ---'
sed -n '25,82p' src/renderer/src/lib/pane-manager/pane-terminal-options.ts
printf '%s\n' '--- locate keyboard helper ---'
rg -l "function createAgentSessionKeyboardOptions|createAgentSessionKeyboardOptions" src/renderer/src/runtime src/renderer/src/lib src/renderer/src/components/terminal-pane | head -20
printf '%s\n' '--- background caller ---'
sed -n '130,215p' src/renderer/src/lib/launch-agent-background-session.ts
printf '%s\n' '--- remote launch test capability cases ---'
sed -n '385,455p' src/renderer/src/lib/launch-agent-background-session-remote.test.ts

Repository: stablyai/orca

Length of output: 12000


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- keyboard capability helper ---'
cat -n src/renderer/src/runtime/agent-session-keyboard-capability.ts
printf '%s\n' '--- remote launch wrapper ---'
rg -n -A120 -B20 "export function runRemoteAgentSessionLaunch|function runRemoteAgentSessionLaunch" src/renderer/src/runtime src/renderer/src/lib
printf '%s\n' '--- background creator references ---'
rg -n -A20 -B12 "createRuntimeAgentBackgroundTerminal" src/renderer/src/lib/launch-agent-background-session.ts src/renderer/src/lib/runtime-agent-background-create.ts

Repository: stablyai/orca

Length of output: 16678


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- all repository consumers ---'
rg -n -A18 -B12 "terminalKittyKeyboardProtocol" --glob '!src/renderer/src/lib/runtime-agent-background-create.ts' --glob '!src/renderer/src/runtime/agent-session-keyboard-capability.ts' --glob '!src/renderer/src/lib/launch-agent-background-session-remote.test.ts' .
printf '%s\n' '--- effective option gate usages ---'
rg -n -A16 -B12 "buildTerminalKeyboardProtocolOptions|shouldDisableKittyKeyboardForTerminal|isLocalNativeWindowsConpty" src/renderer/src

Repository: stablyai/orca

Length of output: 50370


Forward the effective renderer capability.

createRuntimeAgentBackgroundTerminal reads the static true value from buildDefaultTerminalOptions(). The caller supplies no override, and downstream runtime code forwards terminalKittyKeyboardProtocol to terminal creation without applying the renderer’s platform gate.

When the effective xterm capability is false, a compatible host can still receive terminalKittyKeyboardProtocol: true through both launch paths. Pass the effective renderer capability into this function and add a false-capability test.

Comment on lines +90 to +91
const keyboardProtocol = buildDefaultTerminalOptions().vtExtensions?.kittyKeyboard
const keyboardOptions = createAgentSessionKeyboardOptions(keyboardProtocol)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '60,210p' src/renderer/src/runtime/web-runtime-terminal-create-operation.ts
rg -n "webRuntimeTerminalCreateOperation|buildDefaultTerminalOptions|kittyKeyboard|isWindows|win32" src/renderer/src/runtime src/renderer/src/components/terminal-pane | head -260

Repository: stablyai/orca

Length of output: 40806


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- helper definitions and usages ---'
rg -n -C 8 "function createAgentSessionKeyboardOptions|const createAgentSessionKeyboardOptions|createAgentSessionKeyboardOptions|function buildDefaultTerminalOptions|const buildDefaultTerminalOptions|kittyKeyboard" src/renderer/src src shared | head -500
printf '%s\n' '--- capability and renderer input sources ---'
rg -n -C 6 "AGENT_SESSION_KEYBOARD_RUNTIME_CAPABILITY|agent-session.keyboard.v1|keyboard.*capabil|kitty.*capabil|effective.*capabil|input.*capabil|renderer.*capabil" src/renderer/src src/main shared | head -500
printf '%s\n' '--- createTerminal contract and handlers ---'
rg -n -C 8 "session\\.tabs\\.createTerminal|CreateTerminalTab|createTerminal" src/renderer/src/runtime src/main src/shared shared | head -500

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- keyboard capability helper ---'
cat -n src/renderer/src/runtime/agent-session-keyboard-capability.ts
printf '%s\n' '--- terminal option implementation ---'
fd -i -t f 'pane-terminal-options' .
for f in $(fd -i -t f 'pane-terminal-options' .); do
  echo "FILE $f"
  rg -n -C 12 "buildDefaultTerminalOptions|kittyKeyboard|vtExtensions" "$f"
done
printf '%s\n' '--- exact createTerminal matches ---'
rg -l "session\\.tabs\\.createTerminal|CreateTerminalTab" src | sort
printf '%s\n' '--- capability-related exact matches ---'
rg -n -C 4 "agent-session\\.keyboard\\.v1|AGENT_SESSION_KEYBOARD_RUNTIME_CAPABILITY|terminalKittyKeyboardProtocol" src --glob '!**/*.test.*' | head -240

Repository: stablyai/orca

Length of output: 27680


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- operation signature and callers ---'
cat -n src/renderer/src/runtime/web-runtime-terminal-create-operation.ts | sed -n '1,260p'
printf '%s\n' 'CALLERS'
rg -n -C 8 "webRuntimeTerminalCreateOperation|createWebRuntimeTerminal|WebRuntimeTerminalCreate|runWebRuntimeTerminal" src/renderer/src --glob '!**/*.test.*'
printf '%s\n' '--- relevant caller and active terminal capability paths ---'
cat -n src/renderer/src/lib/runtime-agent-background-create.ts | sed -n '1,130p'
cat -n src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts | sed -n '25,50p'
printf '%s\n' '--- legacy schema and handler ---'
cat -n src/main/runtime/rpc/methods/session-tabs-schemas.ts | sed -n '1,260p'
cat -n src/main/runtime/rpc/methods/session-tabs.ts | sed -n '1,260p'

Repository: stablyai/orca

Length of output: 40469


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- web-runtime callers ---'
rg -n -C 12 "createWebRuntimeSessionTerminal(?:WithLaunchDraft)?\\(|createWebRuntimeAgentSessionTerminal\\(" src --glob '!**/*.test.*'
printf '%s\n' '--- web-runtime argument type ---'
cat -n src/renderer/src/runtime/web-runtime-session-types.ts | sed -n '13,48p'
printf '%s\n' '--- legacy parameter definition ---'
rg -n -C 18 "CreateTerminalTab" src/shared/rpc-contract/session-tabs-schemas-params.ts
printf '%s\n' '--- non-test vtExtensions assignments ---'
rg -n -C 8 "vtExtensions" src/renderer/src --glob '!**/*.test.*' | head -220

Repository: stablyai/orca

Length of output: 45178


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- effective keyboard policy ---'
cat -n src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.ts | sed -n '1,100p'
rg -n -C 10 "buildTerminalKeyboardProtocolOptions|shouldDisableKittyKeyboardForTerminal" src/renderer/src --glob '!**/*.test.*'
printf '%s\n' '--- complete legacy schema tail ---'
cat -n src/shared/rpc-contract/session-tabs-schemas-params.ts | sed -n '135,185p'

Repository: stablyai/orca

Length of output: 20088


Use the effective renderer Kitty capability.

buildDefaultTerminalOptions() always sets vtExtensions.kittyKeyboard to true. The native Windows ConPTY policy can override the effective renderer value to false, but this operation has no platform or effective-capability gate. A structured agent launch can therefore pass terminalKittyKeyboardProtocol: true to a host that supports agent-session.keyboard.v1, even when the renderer must withhold Kitty support. This can cause Windows clients to lose modified-key or navigation-key handling.

Pass the caller's effective renderer capability into this operation and use it instead of buildDefaultTerminalOptions(). Add coverage for the false-capability path.

@nwparker
nwparker merged commit ea02d90 into main Sep 19, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OMP launched from the agent shortcut cannot distinguish Ctrl+Shift chords

1 participant