Skip to content

feat(native-chat): number keys and auto-advance for questions - #26288

Merged
brennanb2025 merged 5 commits into
stablyai:mainfrom
AmoabaKelvin:native-chat-question-number-keys
Oct 8, 2026
Merged

brennanb2025 merged 5 commits into
stablyai:mainfrom
AmoabaKelvin:native-chat-question-number-keys

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​319 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​318
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​262 $\color{#cf222e}{\Huge{\mathbf{−}}}$​61 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​201

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:

  • Number keys. On desktop, 1–9 pick the option with that number. On a pick-several question the key toggles the option.
  • Pick-one questions move on by themselves. The chosen row shows as selected for 200ms, then the card goes to the next question, or sends the answers on the last one. Picking the same option again inside that 200ms takes it back. This works on desktop and on the phone.
  • Unchanged. Pick-several questions and typed answers still wait for Submit.

How it works:

  • The question card listens for digit keys at the document level, because focus drops to the page body when a clicked option row is replaced by the next question's rows. It only acts when its chat pane is the visible, focused one and the key was pressed inside that pane or on nothing in particular. Digits typed into a text field, a dialog, another split or a terminal are left alone.
  • The 200ms pause is one cancellable timer. Cancel, collapse, switching question tab, typing an answer or pressing Submit drops it, so a pick never sends after the user has moved on.
  • When the card moves to the next question it takes keyboard focus back, so Escape and tabbing keep working.

Two gaps this made easier to hit, fixed here:

  • In a structured chat the question and approval cards stayed interactive after a response was sent, so a second key press could send a second response. The card now locks from the press until the host refuses the response.
  • On the phone, options and question tabs stayed tappable while an answer was being delivered. They are now disabled for that time.

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.

  • Keys are scoped to the focused pane instead of the whole window. Orca shows several chats, terminals and dialogs at once, and an app-wide listener would let a digit pressed elsewhere answer a question.
  • A pause instead of sending instantly. An earlier version of this card sent on the first click and was changed because the card vanished before the user saw anything happen. The pause shows the selection first, and desktop then shows "Sending…" until delivery is confirmed.
  • Considered and not done: stopping on the last question of a multi-question prompt to require Submit. It is safer against a mistyped digit but costs a keypress on every multi-question prompt. Easy to add later if mis-sends turn out to be a problem.

Visual Proof

CleanShot.2026-10-07.at.5.43.05.PM.mp4
CleanShot.2026-10-07.at.5.37.56.PM.mp4

Testing

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

Automated coverage added:

  • Desktop question card: a pick-one answer advances and then sends after the pause; cancelling during the pause sends nothing; a number key picks its option; number keys toggle pick-several options without sending; a key pressed on a row inside the pane picks; keys are ignored in the answer field, on another surface, in an unfocused pane, past the last option and with a modifier held; focus returns to the card when the focused option is replaced.
  • Structured chat: the question card is given the keyboard, is held while its answer is with the host, and is released when the host refuses.
  • Phone question card (new test file): advance then send across two questions; "Other…" waits for text; pick-several waits for Submit; cancel during the pause sends nothing; choices are held during delivery.

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

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: the shortcut is a bare digit with no modifier, so there is no Cmd/Ctrl difference. Digits pressed with Cmd, Ctrl or Alt are ignored, which leaves the existing tab and workspace shortcuts alone.
  • Remote SSH: no change to how answers are delivered. The card calls the same send path as the Submit button, for local and remote chats.
  • Mobile: the phone card gets the auto-advance and the delivery lock; number keys do not apply there. The 200ms value is one shared constant.
  • Backwards compatibility: nothing sent between client and host changes.
  • Performance: one document key listener while a question card owns the focused pane, removed when it does not.
  • Known and left alone: in a structured chat, picking on the last question does nothing if an earlier question was skipped, the same as pressing Submit there today.

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)

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.
@coderabbitai

coderabbitai Bot commented Oct 7, 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: 7b8dcd88-87c7-4264-946c-9f4ceaf19ad1
📥 Commits

Reviewing files that changed from the base of the PR and between b7a60ba and 2e75062.

📒 Files selected for processing (3)
  • src/renderer/src/components/native-chat/NativeChatQuestionCard.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredQuestionCard.tsx
  • 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; 2 remain after this review.


📝 Walkthrough

Walkthrough

Mobile 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 2e750

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main changes: number-key selection and automatic advancement for native chat questions.
Description check ✅ Passed The description is complete and follows the repository template. It explains the user-facing behavior, implementation approach, rationale, linked issue placeholder, visual proof, testing, compatibilit…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
  • Autopilot · 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.

@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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 00234af1-b383-4c37-b977-30def26af31d
📥 Commits

Reviewing files that changed from the base of the PR and between 80d4509 and 4194aa7.

📒 Files selected for processing (12)
  • mobile/src/session/MobileNativeChatAsk.test.tsx
  • mobile/src/session/MobileNativeChatAsk.tsx
  • mobile/src/session/use-mobile-native-chat-ask-auto-advance.ts
  • src/renderer/src/components/native-chat/NativeChatQuestionCard.test.tsx
  • src/renderer/src/components/native-chat/NativeChatQuestionCard.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/use-native-chat-prompt-card-focus.ts
  • src/renderer/src/components/native-chat/use-native-chat-question-auto-advance.ts
  • src/renderer/src/components/native-chat/use-native-chat-question-number-keys.ts
  • src/renderer/src/components/native-chat/use-structured-prompt-response-hold.ts
  • src/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 {

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

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) and vi.fn(() => new Promise<boolean>(() => {})) both infer a mock that takes no parameters.
  • Vitest types toHaveBeenCalledExactlyOnceWith from the mock's Parameters<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

@brennanb2025

Copy link
Copy Markdown
Contributor

Will resolve conflicts and merge!

…6288-merge

# Conflicts:
#	src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx

@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.

Caution

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

⚠️ Outside diff range comments (1)

🟡 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 win

Reject Shift-modified digit events.

On the standard French AZERTY layout, Shift+1 produces event.key === "1" with event.shiftKey === true. The enabled document handler accepts that event and pickOption selects option index 0. Add event.shiftKey to 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 win

Add 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 onAnswer is 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
📥 Commits

Reviewing files that changed from the base of the PR and between 4194aa7 and 4950515.

📒 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
@brennanb2025
brennanb2025 merged commit 7c88ab7 into stablyai:main Oct 8, 2026
35 of 37 checks passed
brennanb2025 added a commit that referenced this pull request Oct 20, 2026
…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
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.

2 participants