Repository navigation
feat(mobile): add Codex answer/skip quick keys for pending questions - #21249
JHXSMatthew wants to merge 1 commit into
Conversation
When a Codex question is pending while the terminal is visible, the command-dock accessory bar now shows Answer (opens the chat wizard) and Skip (drives the overlay's DEL + Proceed confirmation). The in-chat ask wizard's final Skip also goes through the new skip seam instead of sending Escape, so the agent proceeds past every question rather than cancelling. Skip is bridge-lane Codex-only: Claude's bare Enter commits the highlighted default, and the structured lane requires an answer. Co-Authored-By: Claude Code <[email protected]>
There was a problem hiding this comment.
Important
The new onSkip seam is handed to the in-chat wizard for every non-structured agent, but only Codex can service it — so Claude/openclaude/grok/omp sessions get an enabled Skip that silently does nothing when nothing is answered. That is the opposite of the behavior the component's own JSDoc and the new test describe. Details inline.
Reviewed changes
- Terminal-dock quick keys — new
MobileCodexAskAccessoryKeysrenders an Answer/Skip pair at the front of the accessory row whilenativeChatAsk !== null && nativeChatAgent === 'codex'; Answer toggles to the chat view, Skip driveshandleNativeChatSkipAskbehind an in-flight latch that re-arms onaskKeychange. - Codex skip write — new
skipAskon the bridge-lane prompt writes: Codex-only guard, thenanswerAsk(prompt, all-empty, { allowEmpty: true }). - Answer-send
allowEmptyoption — an all-empty answer is refused unlessallowEmptyis set and the transcript agent is Codex (Claude's bare Enter commits the highlighted default). - Ask wizard semantics —
allAnswered→anyAnswered; the trailing button advances unanswered steps and submits once anything is answered; a final Skip with nothing answered routes to the newonSkipseam, while Cancel still dismisses. - Controller wiring —
handleNativeChatSkipAskis exposed on the native chat controller asactiveChatStructured ? undefined : skipAsk, threaded through overlay → view → prompt card. - Tests / ratchets — new component and wizard tests, new builder sequences in
mobile-native-chat-ask.test.ts,allowEmptycases in the answer-send test, and refreshed route-parity hashes.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| dismissNativeChatAsk, | ||
| handleNativeChatAnswerAsk: answerAsk, | ||
| /** Bridge-lane Codex: skip every question in the pending overlay. */ | ||
| handleNativeChatSkipAsk: activeChatStructured ? undefined : skipAsk, |
There was a problem hiding this comment.
This seam is exposed for every non-structured session, but skipAsk only writes for Codex and returns false otherwise. Since MobileNativeChatAsk treats any truthy onSkip as "skip is supported" (canAdvance becomes true and the button renders as an enabled Skip), a Claude/openclaude/grok/omp bridge session now shows a Skip button that silently no-ops when nothing is answered — the exact state the wizard's JSDoc and the new disables the final Skip without a skip seam test claim is disabled.
The disabled path is in fact unreachable: the wizard only renders when nativeChatAsk is non-null, and nativeChatAsk is nulled for structured sessions, so the only lane that mounts MobileNativeChatAsk always has this seam defined.
Technical details
# Non-Codex sessions get an enabled, no-op wizard Skip
## Affected sites
- mobile/src/session/use-mobile-native-chat-controller.ts:305 — `handleNativeChatSkipAsk` gated only on `activeChatStructured`, not on the agent.
- mobile/src/session/use-mobile-bridge-chat-prompt-writes.ts:44-56 — `skipAsk` returns `false` for any non-codex agent without writing.
- mobile/src/session/MobileNativeChatOverlay.tsx:85 — forwards the seam to the view unconditionally.
- mobile/src/session/MobileNativeChatPromptCard.tsx:49-59 — turns a truthy `onSkipAsk` into the wizard's `onSkip`.
- mobile/src/session/MobileNativeChatAsk.tsx:85 — `canAdvance = !submitting && (!isLast || anyAnswered || !!onSkip)`; a truthy `onSkip` is the only thing enabling the empty final button.
- mobile/src/session/MobileNativeChatAsk.test.tsx:57-75 — asserts the disabled state by omitting `onSkip`, a prop combination production never produces for this component.
- mobile/src/session/MobileSessionCommandDock.tsx:123 — already gates its own accessory keys on `nativeChatAgent === 'codex'`, so the intent is established.
## Required outcome
- The wizard must not show an enabled-final-Skip affordance for an agent that cannot service it. Non-Codex bridge sessions should keep the pre-PR disabled final button (Cancel remains the only dismissal), matching the JSDoc and the test's stated contract.
## Suggested approach (optional)
- Gate the returned seam on the agent, e.g. `handleNativeChatSkipAsk: activeChatStructured || nativeChatAgent !== 'codex' ? undefined : skipAsk`, and let a test that renders the real wiring (or a seam that resolves `false`) cover the non-Codex path instead of the currently-unreachable `onSkip === undefined` render.
## Open questions for the human (optional)
- Is the intended non-Codex final-Skip behavior a disabled button (JSDoc) or a dismiss (desktop's `NativeChatQuestionCard.confirm` calls `onCancel`)? Whichever it is, the current wiring does neither.
📝 WalkthroughWalkthroughAdds Codex-only skip handling for native chat questions. The ask wizard can skip unanswered steps and submit partial answers. The controller and overlay pass the skip callback through the chat components. The terminal command dock now renders Answer and Skip keys for pending Codex questions. Skip writes Codex-specific keystrokes and prevents duplicate submissions. Tests cover wizard behavior, accessory state, keystrokes, and route parity. Priority: ➖ Normal Merge Risk: 🔵 Low · up to Some non-Codex chat prompts can show a Skip action that does nothing. Gate that action to Codex before merging. 🚥 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: c4e46d42-155b-4d49-91e9-80ac5b642677
📒 Files selected for processing (16)
mobile/src/session/MobileCodexAskAccessoryKeys.test.tsxmobile/src/session/MobileCodexAskAccessoryKeys.tsxmobile/src/session/MobileNativeChatAsk.test.tsxmobile/src/session/MobileNativeChatAsk.tsxmobile/src/session/MobileNativeChatOverlay.tsxmobile/src/session/MobileNativeChatPromptCard.tsxmobile/src/session/MobileNativeChatView.tsxmobile/src/session/MobileSessionCommandDock.tsxmobile/src/session/mobile-native-chat-ask.test.tsmobile/src/session/mobile-native-chat-controller-contract.tsmobile/src/session/mobile-session-route-parity.test.tsmobile/src/session/mobile-session-route-source-family.test-support.tsmobile/src/session/use-mobile-bridge-chat-prompt-writes.tsmobile/src/session/use-mobile-native-chat-answer-send.test.tsmobile/src/session/use-mobile-native-chat-answer-send.tsmobile/src/session/use-mobile-native-chat-controller.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| dismissNativeChatAsk, | ||
| handleNativeChatAnswerAsk: answerAsk, | ||
| /** Bridge-lane Codex: skip every question in the pending overlay. */ | ||
| handleNativeChatSkipAsk: activeChatStructured ? undefined : skipAsk, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline mobile/src/session/MobileNativeChatPromptCard.tsx --items all
rg -n -C 6 'onSkipAsk|MobileNativeChatAsk|Skip' \
mobile/src/session/MobileNativeChatPromptCard.tsx \
mobile/src/session/MobileNativeChatAsk.tsx \
mobile/src/session/use-mobile-native-chat-controller.tsRepository: stablyai/orca
Length of output: 19944
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- candidate bridge files ---'
fd -i 'use-mobile-bridge-chat-prompt-writes|mobile-bridge-chat-prompt-writes|bridge.*prompt.*write' mobile src
printf '%s\n' '--- bridge hook references ---'
rg -n -C 8 'function useMobileBridgeChatPromptWrites|const useMobileBridgeChatPromptWrites|skipAsk|resolved agent|Codex|Claude' mobile/src/session mobile/src 2>/dev/null | head -n 260Repository: stablyai/orca
Length of output: 23851
🏁 Script executed:
#!/bin/bash
set -euo pipefail
wc -l mobile/src/session/use-mobile-bridge-chat-prompt-writes.ts mobile/src/session/use-mobile-native-chat-controller.ts
printf '%s\n' '--- bridge prompt writes ---'
cat -n mobile/src/session/use-mobile-bridge-chat-prompt-writes.ts
printf '%s\n' '--- controller hook setup ---'
sed -n '120,205p' mobile/src/session/use-mobile-native-chat-controller.tsRepository: stablyai/orca
Length of output: 7386
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,125p' mobile/src/session/use-mobile-native-chat-controller.ts
rg -n -C 5 'activeChatAgentRef|activeChatResolution|resolveNativeChatTranscriptAgent|agentRef' mobile/src/session/use-mobile-native-chat-controller.ts mobile/src/session | head -n 220Repository: stablyai/orca
Length of output: 24950
Gate the exposed skip handler to Codex.
useMobileBridgeChatPromptWrites returns false for non-Codex agents. MobileNativeChatPromptCard passes the defined handler to MobileNativeChatAsk, which enables the final unanswered Skip action. Claude can therefore receive an enabled control that does not work. Expose the handler only when activeChatResolution?.agent is codex.
handleNativeChatSkipAsk:
activeChatStructured || activeChatResolution?.agent !== 'codex' ? undefined : skipAsk,|
Closing after on-device testing on a physical Android device: the terminal-dock Answer quick key did not work as expected, so this is not ready for review. The Skip path and the pinning-related PR #20984 are unaffected. Will reopen a new PR after investigating the Answer flow (likely the terminal→chat wizard handoff) and re-verifying on device. |
|
@JHXSMatthew I've opened #30062 for Codex async-question cards in mobile and desktop chat. It reuses the existing mobile question wizard, adds Other input, and keeps pending questions available outside the loaded transcript page. It does not bring back the terminal-dock Answer/Skip controls or fix the on-device Answer handoff you described when closing this PR. That work remains separate under #21247. Linking it here because a renewed quick-key implementation will touch the same mobile question UI, and #30062 may be useful context when rebasing it. |

ELI5
When a Codex agent pauses to ask a question and you're looking at the terminal (not the chat) in the mobile app, the quick-key row above the keyboard had no way to deal with it — you had to switch to the chat view first. Now two quick keys appear in that row while a Codex question is waiting: Answer (jumps to the chat question wizard) and Skip (skips every question and tells Codex to proceed, like the desktop card).
What Changed
Mobile-only (React Native app under
mobile/), no wire/RPC changes — Skip drives Codex's existing overlay purely with keystrokes.mobile/src/session/MobileCodexAskAccessoryKeys.tsx(new): the dock's Answer / Skip quick-key pair, shown only while a Codex ask is pending in the bridge/terminal lane. Answer opens the chat wizard via the existingtoggleTabChatView; Skip drives the skip-all keystrokes. An in-flight latch (plus an ask-key reset) prevents a second DEL landing before the overlay's blocked status clears.mobile/src/session/use-mobile-bridge-chat-prompt-writes.ts: newskipAsk(prompt)seam — Codex-only guard (resolveNativeChatTranscriptAgent), answers with one empty selection per question and the newallowEmptyoption.mobile/src/session/use-mobile-native-chat-answer-send.ts:answerAskgains an explicitallowEmptyoption, hard-restricted to Codex. Claude's bare Enter commits the highlighted default, so an all-empty answer is refused there even with the flag.mobile/src/session/use-mobile-native-chat-controller.ts/mobile-native-chat-controller-contract.ts: exposehandleNativeChatSkipAskon the native chat controller, bridge lane only (undefined for structured app-server sessions, which require an answer and have no skip RPC).mobile/src/session/MobileNativeChatAsk.tsx: the in-chat wizard's final Skip (nothing answered anywhere) now goes through a distinctonSkipseam instead of the Escape/cancel seam — so Skip means "proceed past every question" while Cancel keeps meaning "dismiss". On a non-Codex bridge session without the skip seam, the final Skip is disabled and Cancel remains the only dismissal.mobile/src/session/MobileNativeChatPromptCard.tsx/MobileNativeChatView.tsx/MobileNativeChatOverlay.tsx: thread the new skip prop through to the wizard.mobile/src/session/MobileSessionCommandDock.tsx: renders the new pair at the front of the accessory ScrollView while a Codex question is pending.Why
The shared keystroke builder
buildCodexAskAnswerKeysalready supported skipping every question (DEL per skipped question, tab between questions, and one final Enter for Codex's Proceed confirmation), but mobile UI could never reach it: the answer send hard-required at least one answer, and the terminal dock had no ask controls at all. This exposes the proven builder with a narrow Codex-only gate, reusing every existing paced-write/write-lock/generation-fence mechanism. Desktop parity for the wizard's Skip semantics.Linked Issue
Fixes #21247
Testing
Automated (Node 22 + pnpm 12, macOS):
MobileCodexAskAccessoryKeys.test.tsx: Answer fires the answer callback; Skip fires once and latches while in flight, re-arms on a new ask key, and re-enables immediately when the write is rejected.MobileNativeChatAsk.test.tsx: single unanswered question Skip goes throughonSkip(never answer/cancel); Skip disabled without a skip seam; multi-question step-skip then answer submits[{}, {selection}]without skip/cancel.mobile-native-chat-ask.test.ts: builder sequences for one/two/three questions with skip-all and a middle answer (\x7f,\x1b[C, option digit, final\r).use-mobile-native-chat-answer-send.test.ts: Codex skip-all keystrokes only withallowEmpty; Claude empty answer refused even with the flag.pnpm typecheckclean; oxlint + oxfmt clean. Frozen-tree parity ratchet refreshed (newMobileCodexAskAccessoryKeyssurface added to the route family).Manual Android verification — pending real-device testing by the maintainer; an installable APK is attached/linked below. Expected flows:
AI Disclosure
This implementation was written with Claude Code (AI pair programming). All code was reviewed by the author.
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
pnpm lint,pnpm typecheck, andpnpm testpass locally🤖 Generated with Claude Code