Repository navigation
fix(native-chat): answer OMP ask questions with navigation keys - #29184
daniellp-rubio wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
|
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. |
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 withmainand 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
askdialog ignores pasted text and has no number shortcuts, so that Enter acted on the highlighted row:recommendedrow (or the first one), not the option the user tapped.multi: truequestions showed up as single-select cards, because Orca only readmultiSelectand OpenCode'smultiple.After:
shouldStepNativeChatAskAnswernow includesomp. OMP answers go through the same paced key sender that Claude, Codex and OpenCode already use, on desktop and on mobile.buildOmpAskAnswerKeysfollows OMP's dialog: it clears leftover composer text, presses Up to reach the top row (the highlight starts onrecommended), 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: truenow parses as multi-select.Conflict resolution (the only change on top of #26688):
mainno longer passessettings(getSettingsForAgentTabRuntimeOwner) tosendNativeChatAskAnswer/sendNativeChatMessage. The resolution drops thatconst settings = …line fromuse-native-chat-interactive-send.tsand keeps the new comment andbuildNativeChatAskAnswerKeyscall.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
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.tsbetween 18.8.7 and 18.11.0, and the keys this fix uses behave the same. The only new key isapp.ask.hide(Alt+H), which Orca never sends.Before and after against OMP 18.11.0's real dialog. A script drives
AskDialogComponentfrom npm@oh-my-pi/pi-tui@18.11.0. Each key group goes through OMP's ownStdinBuffer, so every write is split into keys the way the TUI does it. The groups come from this branch'sbuildOmpAskAnswerKeys. The "Other" editor is simulated with the dialog'sonPromptcallback. This is a component-level check, not the full binary; #26688 covers the real-binary run on 18.2.0 – 18.8.7.main)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.src/shared/native-chat-ask.test.ts,src/shared/native-chat-agent-support.test.tsandsrc/renderer/src/components/native-chat/: 366 files and 3,853 tests pass. I ran it throughconfig/scripts/run-vitest.mjsbecausepnpm test's native-runtime step needs Visual Studio to rebuildnode-pty, which this machine doesn't have.pnpm run check:code-quality:changed: passes, 0 findings across the 9 changed files. Withoutmobile/node_modulesinstalled, the type-aware step reportsReactTestRendereras an error type; it goes away once the mobile dependencies are installed.oxlintandoxfmt --checkon the changed files: clean.pnpm typecheck(after thepostinstallgenerators) andpnpm lintpass.vitest run src/session/use-mobile-native-chat-answer-sendpasses 2 files and 37 tests, including the new OMP pacing test.oxfmt --checkis clean on the changed mobile files.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:
AskDialogComponentin 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 thatmainalready dropped.buildNativeChatAskAnswerKeyssends OpenCode to the Claude-style builder, asmaindoes today.Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred). The local runs are listed under Testing; fullpnpm lintandpnpm buildare left to CI.