Repository navigation
feat(native-chat): number keys and auto-advance for questions - #26288
Conversation
A single-select pick moves on after a short beat, on desktop and phone. Structured chats hold the card while a response is with the host.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughMobile and renderer question cards advance after a newly selected single-select option, using a 200-millisecond delay. “Other…” and multi-select choices do not trigger automatic advancement. The renderer adds guarded number-key option selection and focus handling for question changes. Structured prompt cards track pending responses, and mobile choices are disabled while answer delivery is pending. Tests cover advancement, cancellation, keyboard selection, focus, and response state. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Number-key selection does not need a card-only restriction. Confirm the mobile test typecheck ratchet before merging, because the earlier reported failure has not been shown to be fixed. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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: Advanced
- Run ID:
00234af1-b383-4c37-b977-30def26af31d
📒 Files selected for processing (12)
mobile/src/session/MobileNativeChatAsk.test.tsxmobile/src/session/MobileNativeChatAsk.tsxmobile/src/session/use-mobile-native-chat-ask-auto-advance.tssrc/renderer/src/components/native-chat/NativeChatQuestionCard.test.tsxsrc/renderer/src/components/native-chat/NativeChatQuestionCard.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/use-native-chat-prompt-card-focus.tssrc/renderer/src/components/native-chat/use-native-chat-question-auto-advance.tssrc/renderer/src/components/native-chat/use-native-chat-question-number-keys.tssrc/renderer/src/components/native-chat/use-structured-prompt-response-hold.tssrc/shared/native-chat-question-auto-advance.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
|
|
||
| let tree: ReactTestRenderer | ||
|
|
||
| function render(prompt: AskPrompt, onAnswer = vi.fn(async () => true)): typeof onAnswer { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Type the onAnswer mocks with the selections parameter so the test typechecks.
The Mobile Checks typecheck ratchet fails on this file. The likely cause is the two mock declarations:
vi.fn(async () => true)andvi.fn(() => new Promise<boolean>(() => {}))both infer a mock that takes no parameters.- Vitest types
toHaveBeenCalledExactlyOnceWithfrom the mock'sParameters<T>. A call with a selections array therefore fails to typecheck. - At Line 98, the never-resolving mock also has a different type from the default parameter's type.
Declare one mock type with the AskAnswerSelection[] parameter and use it in both places.
💚 Proposed fix
-import type { AskPrompt } from '../../../src/shared/native-chat-ask'
+import type { AskAnswerSelection, AskPrompt } from '../../../src/shared/native-chat-ask'
@@
-function render(prompt: AskPrompt, onAnswer = vi.fn(async () => true)): typeof onAnswer {
+type OnAnswer = (selections: AskAnswerSelection[]) => Promise<boolean>
+function render(
+ prompt: AskPrompt,
+ onAnswer = vi.fn<OnAnswer>(async () => true)
+): typeof onAnswer {
@@
- vi.fn(() => new Promise<boolean>(() => {}))
+ vi.fn<OnAnswer>(() => new Promise<boolean>(() => {}))Also applies to: 96-99
Source: Pipeline failures
|
Will resolve conflicts and merge! |
…6288-merge # Conflicts: # src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Reject Shift-modified digit events. · use-native-chat-question-number-keys.ts:16-24
src/renderer/src/components/native-chat/use-native-chat-question-number-keys.ts:16-24
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReject
Shift-modified digit events.On the standard French AZERTY layout,
Shift+1producesevent.key === "1"withevent.shiftKey === true. The enabled document handler accepts that event andpickOptionselects option index0. Addevent.shiftKeyto the modifier checks.Suggested fix
event.ctrlKey || event.altKey || + event.shiftKey || !/^[1-9]$/.test(event.key)
🧹 Nitpick comments (1)
mobile/src/session/MobileNativeChatAsk.test.tsx (1)
47-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a pre-delay reselection regression test.
The card-path tests do not reselect the active option before the 200 ms timer expires. Add a two-question case that reselects the option, advances the timer, and asserts that the first question remains visible and
onAnsweris not called.Suggested fix
it('moves to the next question after a pick and sends after the last one', async () => { const onAnswer = render({ questions: [indent, fruit] }) press('Spaces') @@ expect(onAnswer).toHaveBeenCalledExactlyOnceWith([{ indices: [1] }, { indices: [0] }]) }) + it('cancels auto-advance when the selected option is reselected', async () => { + const onAnswer = render({ questions: [indent, fruit] }) + + press('Spaces') + press('Spaces') + await passAutoAdvanceBeat() + + expect(shows('Tabs or spaces?')).toBe(true) + expect(shows('Which fruit?')).toBe(false) + expect(onAnswer).not.toHaveBeenCalled() + }) + it('waits for the typed text when "Other…" is picked', async () => {
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
9524e0fb-70c1-488b-8e9b-41f1ac59f339
📒 Files selected for processing (1)
src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
…6288-merge # Conflicts: # src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
…6288-merge # Conflicts: # src/renderer/src/components/native-chat/NativeChatQuestionCard.tsx # src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
…cs (#30897) The daily full E2E run on main fails these specs every time because the product moved on and PR CI only runs specs a PR touches: - editor header menu renamed to File actions (#30129) - terminal attention: an on-screen bell leaves no unread marker (#28637) - terminal file drops carry their source host (#26830) - single-choice questions auto-submit (#26288) - phone terminal rows carry customTitle (#30037) - gh/git preflight re-reads the login shell PATH (#25183) - board drag starts after the target column is in view - chat history anchor read after scroll settles
ELI5
When an agent asks you a question in chat, the options are numbered. Now pressing that number picks the option. And when a question only takes one answer, picking it is enough: the card moves to the next question, or sends your answers after the last one, without a separate Submit click.
What Changed
Before: the numbers beside the options were only labels. Every question, including a simple pick-one, needed a click on the option and then a click on Next or Submit.
After:
How it works:
Two gaps this made easier to hit, fixed here:
Why
Answering an agent's question is the most frequent interruption in a chat, and most questions are pick-one. Two clicks for those is one more than needed, and the visible numbers suggested a shortcut that did not exist.
Visual Proof
CleanShot.2026-10-07.at.5.43.05.PM.mp4
CleanShot.2026-10-07.at.5.37.56.PM.mp4
Testing
Automated coverage added:
To try it: start a chat, have the agent ask a pick-one question, press the option's number. Then try a multi-question prompt, a pick-several question, and typing a digit into the "Type your answer" field (it should type, not pick).
Review
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
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)