Skip to content

feat(mobile): add Codex answer/skip quick keys for pending questions - #21249

Closed
JHXSMatthew wants to merge 1 commit into
stablyai:mainfrom
JHXSMatthew:JHXSMatthew/mobile-codex-answer-skip-keys
Closed

JHXSMatthew wants to merge 1 commit into
stablyai:mainfrom
JHXSMatthew:JHXSMatthew/mobile-codex-answer-skip-keys

Conversation

@JHXSMatthew

Copy link
Copy Markdown
Contributor

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 existing toggleTabChatView; 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: new skipAsk(prompt) seam — Codex-only guard (resolveNativeChatTranscriptAgent), answers with one empty selection per question and the new allowEmpty option.
  • mobile/src/session/use-mobile-native-chat-answer-send.ts: answerAsk gains an explicit allowEmpty option, 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: expose handleNativeChatSkipAsk on 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 distinct onSkip seam 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 buildCodexAskAnswerKeys already 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):

  • New 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.
  • New MobileNativeChatAsk.test.tsx: single unanswered question Skip goes through onSkip (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 with allowEmpty; Claude empty answer refused even with the flag.
  • Full mobile suite: 611 files / 5940 tests passed (6 pre-existing skips); pnpm typecheck clean; oxlint + oxfmt clean. Frozen-tree parity ratchet refreshed (new MobileCodexAskAccessoryKeys surface added to the route family).

Manual Android verification — pending real-device testing by the maintainer; an installable APK is attached/linked below. Expected flows:

  1. Terminal view, Codex pauses on a question → Answer / Skip quick keys appear at the front of the accessory row.
  2. Answer → switches to chat wizard; picking options submits exactly as before.
  3. Skip → Codex skips the question(s) and proceeds (Proceed confirmation); key disables until the overlay clears; no double-skip on rapid taps.
  4. In-chat wizard with zero answers → final Skip skips (Codex); Cancel still dismisses; structured app-server Codex shows neither dock (terminal view never renders there).
  • I manually tested these changes locally — pending physical-device verification by the maintainer
  • Automated tests added/updated

AI Disclosure

This implementation was written with Claude Code (AI pair programming). All code was reviewed by the author.

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

  • Security: no new IPC, auth, or secret handling; client-side keystroke writes through the existing answer seam.
  • Cross-platform: mobile JS only (Android/iOS); desktop unchanged.
  • Remote SSH / folder workspaces: no change — writes use the existing terminal session handle and paced-write path shared by all hosts.
  • Mixed client/server versions: no wire/RPC/stream change; an old host needs no update because Skip is synthesized client-side from the same terminal input channel answers already use.
  • Backwards compatibility: Codex bridge lane only; Claude (Enter commits the default) and structured sessions are untouched.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes — on-device verification pending; can attach on request
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, and pnpm test pass locally

🤖 Generated with Claude Code

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]>

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

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 MobileCodexAskAccessoryKeys renders an Answer/Skip pair at the front of the accessory row while nativeChatAsk !== null && nativeChatAgent === 'codex'; Answer toggles to the chat view, Skip drives handleNativeChatSkipAsk behind an in-flight latch that re-arms on askKey change.
  • Codex skip write — new skipAsk on the bridge-lane prompt writes: Codex-only guard, then answerAsk(prompt, all-empty, { allowEmpty: true }).
  • Answer-send allowEmpty option — an all-empty answer is refused unless allowEmpty is 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 new onSkip seam, while Cancel still dismisses.
  • Controller wiring — handleNativeChatSkipAsk is exposed on the native chat controller as activeChatStructured ? 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, allowEmpty cases in the answer-send test, and refreshed route-parity hashes.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

dismissNativeChatAsk,
handleNativeChatAnswerAsk: answerAsk,
/** Bridge-lane Codex: skip every question in the pending overlay. */
handleNativeChatSkipAsk: activeChatStructured ? undefined : skipAsk,

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.

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.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

Adds 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 4edec

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 16 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 change: adding Codex Answer and Skip quick keys for pending mobile questions.
Description check ✅ Passed The description is comprehensive and covers the user impact, implementation, rationale, linked issue, testing, compatibility, and checklist items. Physical-device testing and required UI visual proof …
Linked Issues check ✅ Passed The pull request satisfies #21247. MobileSessionCommandDock renders Answer and Skip only for pending Codex questions in the terminal bridge lane. Answer switches to the chat view. The chat wizard su…
Out of Scope Changes check ✅ Passed The changes stay within #21247. The added component, prop plumbing, controller seam, Codex empty-answer handling, and tests directly support the terminal Answer and Skip controls. Route-parity updates…
  • Fix all pre-merge checks with AI

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: c4e46d42-155b-4d49-91e9-80ac5b642677

📥 Commits

Reviewing files that changed from the base of the PR and between a3046cd and 4edecf1.

📒 Files selected for processing (16)
  • mobile/src/session/MobileCodexAskAccessoryKeys.test.tsx
  • mobile/src/session/MobileCodexAskAccessoryKeys.tsx
  • mobile/src/session/MobileNativeChatAsk.test.tsx
  • mobile/src/session/MobileNativeChatAsk.tsx
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/MobileNativeChatPromptCard.tsx
  • mobile/src/session/MobileNativeChatView.tsx
  • mobile/src/session/MobileSessionCommandDock.tsx
  • mobile/src/session/mobile-native-chat-ask.test.ts
  • mobile/src/session/mobile-native-chat-controller-contract.ts
  • mobile/src/session/mobile-session-route-parity.test.ts
  • mobile/src/session/mobile-session-route-source-family.test-support.ts
  • mobile/src/session/use-mobile-bridge-chat-prompt-writes.ts
  • mobile/src/session/use-mobile-native-chat-answer-send.test.ts
  • mobile/src/session/use-mobile-native-chat-answer-send.ts
  • mobile/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,

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 | 🟡 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.ts

Repository: 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 260

Repository: 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.ts

Repository: 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 220

Repository: 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,

@JHXSMatthew

Copy link
Copy Markdown
Contributor Author

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.

@miguel93041

Copy link
Copy Markdown

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

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.

[Feature]: Mobile quick keys to answer or skip a pending Codex question from the terminal view

2 participants