Skip to content

fix(native-chat): answer OMP ask questions with navigation keys - #29184

Closed
daniellp-rubio wants to merge 3 commits into
stablyai:mainfrom
daniellp-rubio:fix/omp-ask-answer-keys
Closed

daniellp-rubio wants to merge 3 commits into
stablyai:mainfrom
daniellp-rubio:fix/omp-ask-answer-keys

Conversation

@daniellp-rubio

Copy link
Copy Markdown
Contributor

ELI5

When OMP (Oh My Pi) asks a question with its menu, answering it from Orca's chat card (on the desktop or on the phone) does not work: OMP gets the wrong option, or it gets stuck waiting. Orca types the answer as text, and OMP's menu only listens to the arrow keys. With this change, Orca presses the same keys a person would press in the terminal.

This is the fix from #26688 by @jairuspace, rebased onto current main. That PR has had a merge conflict with main and no CI run since Oct 9, so this branch resolves the conflict and re-verifies the fix. The three commits are @jairuspace's own (authorship kept). The only new change is the conflict resolution. If you would rather merge #26688, the same resolution applies there; close whichever one you don't use.

What Changed

Before: for OMP, the chat card cleared the input, pasted the option label, and pressed Enter. OMP's ask dialog ignores pasted text and has no number shortcuts, so that Enter acted on the highlighted row:

  • One question: OMP got its recommended row (or the first one), not the option the user tapped.
  • Several questions: question 1 got the highlighted row, the dialog then waited on question 2, and OMP stayed blocked.
  • A lone multi-select question: Enter confirmed an empty selection.
  • OMP's multi: true questions showed up as single-select cards, because Orca only read multiSelect and OpenCode's multiple.

After:

  • shouldStepNativeChatAskAnswer now includes omp. OMP answers go through the same paced key sender that Claude, Codex and OpenCode already use, on desktop and on mobile.
  • The new buildOmpAskAnswerKeys follows OMP's dialog: it clears leftover composer text, presses Up to reach the top row (the highlight starts on recommended), then presses Down to the target row. Enter picks a row and Space ticks a multi-select row. Free text goes through "Other (type your own)". Right skips a question, and a final Enter is sent only when the dialog has a Review tab.
  • buildNativeChatAskAnswerKeys(agent, …) picks the key builder for each agent, so desktop and mobile share one choice.
  • multi: true now parses as multi-select.

Conflict resolution (the only change on top of #26688): main no longer passes settings (getSettingsForAgentTabRuntimeOwner) to sendNativeChatAskAnswer / sendNativeChatMessage. The resolution drops that const settings = … line from use-native-chat-interactive-send.ts and keeps the new comment and buildNativeChatAskAnswerKeys call.

Why

OMP's dialog takes input only as keys. Pressing the keys a person would press is the only way to answer it. It needs no change in OMP, and it works on the OMP versions people already have installed. #26688 and #26692 have the full analysis (homing to the top row, Right vs Enter on multi-select, the leftover-text clear).

Linked Issue

Fixes #26692

Supersedes #26688 (same commits, rebased; credit to @jairuspace).

Visual Proof

N/A: no layout change. The change is which keys Orca writes to the terminal. The before and after are in the table under Testing.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Tested on Windows 11 with OMP 18.11.0, the current release, newer than the 18.8.7 that #26688 checked. I diffed ask-dialog.ts between 18.8.7 and 18.11.0, and the keys this fix uses behave the same. The only new key is app.ask.hide (Alt+H), which Orca never sends.

Before and after against OMP 18.11.0's real dialog. A script drives AskDialogComponent from npm @oh-my-pi/pi-tui@18.11.0. Each key group goes through OMP's own StdinBuffer, so every write is split into keys the way the TUI does it. The groups come from this branch's buildOmpAskAnswerKeys. The "Other" editor is simulated with the dialog's onPrompt callback. This is a component-level check, not the full binary; #26688 covers the real-binary run on 18.2.0 – 18.8.7.

Scenario Expected This PR Paste + Enter (main)
1 question, recommended C, pick A A A C
1 question, recommended A, pick C C C A
1 question, free text "my own" "my own" B
5 questions, different recommended rows B, C, A, C, B B, C, A, C, B dialog stays open
2 questions, first skipped (none), A (none), A dialog stays open
lone multi-select A + C A + C A + C (none)
lone multi-select A + free text A + "D" A + "D" (none)
multi-select, then single-select B, C B, C dialog stays open
multi-select + free text, then single-select A + "x", B A + "x", B dialog stays open
4 questions × 3 options (my phone case) Las dos, Ampliar, Probar, Ampliar same dialog stays open

Field report: Orca 1.4.226 on Windows 11 with the iOS app and OMP 18.11.0. On a 4-question card, nothing tapped on the phone reached OMP and the agent stayed blocked, which is the last row above.

Checks on this branch (Node 24.22.0, pnpm 12.8.1, Bun 1.4.3, Windows):

  • pnpm tc: passes.
  • Vitest on src/shared/native-chat-ask.test.ts, src/shared/native-chat-agent-support.test.ts and src/renderer/src/components/native-chat/: 366 files and 3,853 tests pass. I ran it through config/scripts/run-vitest.mjs because pnpm test's native-runtime step needs Visual Studio to rebuild node-pty, which this machine doesn't have.
  • pnpm run check:code-quality:changed: passes, 0 findings across the 9 changed files. Without mobile/node_modules installed, the type-aware step reports ReactTestRenderer as an error type; it goes away once the mobile dependencies are installed.
  • oxlint and oxfmt --check on the changed files: clean.
  • Mobile: pnpm typecheck (after the postinstall generators) and pnpm lint pass. vitest run src/session/use-mobile-native-chat-answer-send passes 2 files and 37 tests, including the new OMP pacing test. oxfmt --check is clean on the changed mobile files.
  • Not run: the full pnpm lint, pnpm build, and a live answer from the phone, which needs a mobile build of this branch.

AI Disclosure

Rebase, conflict resolution, verification and this description were done with Claude (Anthropic) running in Oh My Pi. The fix itself is @jairuspace's work from #26688, which was also written with Claude in Oh My Pi.

Review

AI review of the rebased diff:

  • Correctness: the key plan matches AskDialogComponent in OMP 18.11.0 (shown in the table above) and 18.2.0 – 18.8.7 (in fix(native-chat): answer OMP ask questions with navigation keys #26688). The conflict resolution only removes an argument that main already dropped.
  • Other agents: Claude, OpenClaude, Codex, OpenCode and Grok get exactly the same keys as before. buildNativeChatAskAnswerKeys sends OpenCode to the Claude-style builder, as main does today.
  • Cross-platform, SSH and remote: keys are standard VT arrows, Space, CR and bracketed paste, written through the existing verified, paced sender. There is no new platform-specific or remote-specific path.
  • Mixed versions: nothing changes on the wire. An older mobile app keeps the paste path, which was already broken for OMP.
  • Performance and UI: key groups go out 1 s apart, as for the other agents, so a 5-question answer takes about 11 s inside the card's existing "submitting" state. OMP multi-select questions now render as checkboxes.
  • Security: free text goes through the existing paste sanitizers.
  • Remaining risk (from fix(native-chat): answer OMP ask questions with navigation keys #26688): if the card is stale and OMP's dialog is already gone, the Up keys would recall OMP's message history. Orca removes the card when OMP records the tool result, so that window is small.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred). The local runs are listed under Testing; full pnpm lint and pnpm build are left to CI.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a49b7566-c1e3-4c81-8a16-a22cc0e58045
📥 Commits

Reviewing files that changed from the base of the PR and between 55687fb and d2a1faf.

📒 Files selected for processing: 9
  • mobile/src/session/use-mobile-native-chat-answer-send-omp.test.ts
  • mobile/src/session/use-mobile-native-chat-answer-send.ts
  • src/renderer/src/components/native-chat/native-chat-interactive-prompt.test.ts
  • src/renderer/src/components/native-chat/native-chat-interactive-prompt.ts
  • src/renderer/src/components/native-chat/use-native-chat-interactive-send.ts
  • src/shared/native-chat-agent-support.test.ts
  • src/shared/native-chat-agent-support.ts
  • src/shared/native-chat-ask.test.ts
  • src/shared/native-chat-ask.ts

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

📝 Walkthrough

OMP ask prompts now recognize multi: true and use OMP-specific selector keystrokes for answers. Native chat and mobile send paths use an agent-aware builder that selects the OMP, Codex, or generic answer-key implementation. Tests cover OMP answer sequences, agent dispatch, selector-stepping support, and paced mobile sends.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to d2a1f

The changed answer paths appear ready to merge after normal checks; no actionable issue was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is concise, specific, and accurately describes the main change: using navigation keys to answer OMP ask questions.
Description check Passed The description covers the required sections, explains the user impact and implementation, links issue #26692, documents testing and limitations, and addresses cross-platform and compatibility concern…
Linked Issues check Passed The PR implements the coding requirements in #26692. parseCanonicalQuestionsInput recognizes OMP multi: true. shouldStepNativeChatAskAnswer routes OMP to paced key delivery on desktop and mobile…
Out of Scope Changes check Passed The changes stay within #26692. The shared OMP builder, agent dispatch, desktop and mobile sender integration, parser update, and related tests directly support the reported OMP answer failures. The r…
  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker

Copy link
Copy Markdown
Contributor

Superseded by #31440, now merged. Thank you for the original contribution; contributor credit is preserved in the merge commit.

Verification against the OMP source exposed state-dependent failures in keyboard-driven submission, so the replacement deliberately offers Answer in terminal and prevents automated OMP question-answer/cancel writes. Automatic semantic card answering remains open in #26692.

@nwparker nwparker closed this Oct 21, 2026
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]: Chat view: answering an OMP ask question picks the wrong option or hangs OMP

3 participants