Skip to content

fix(mobile): keep typed commit messages, restore failed shortcut removals, name icon buttons - #30142

Merged
AmoabaKelvin merged 5 commits into
mainfrom
commit-message-and-shortcut-fixes
Oct 18, 2026
Merged

AmoabaKelvin merged 5 commits into
mainfrom
commit-message-and-shortcut-fixes

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​737 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​728
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​282 $\color{#cf222e}{\Huge{\mathbf{−}}}$​130 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​152

ELI5

Fixes from #29067, mostly on mobile:

  • If you type your own commit message while the AI is still writing one, your text now stays.
  • Committing stops the AI, so its late answer can't land in the box the commit just emptied. Desktop had that second problem too.
  • Removing a terminal shortcut that fails to save now shows the shortcut again.
  • Icon-only buttons now have names for VoiceOver and TalkBack.

What Changed

AI commit message (mobile, and desktop for one case)

  • Before: on mobile, text typed while "Generate commit message" ran was replaced by the AI's reply. On both apps, committing during generation emptied the box, and the late reply then filled it with a message for changes already committed.
  • After: mobile follows desktop's two existing rules. The reply only fills an empty box, and Generate is off while the box has text ("Clear the message to regenerate."). Committing from the box stops a running generation; on mobile, Create PR does too. A stopped run's reply is dropped even if the host still finishes it.
  • Desktop: a commit from the box calls the existing Stop (handleCancelGenerate). The success path now writes the message only if its run is still the current one. Before, it recorded the cancel but wrote the message anyway.

Custom terminal shortcuts (mobile)

  • Before: removing a shortcut hid it at once and swallowed a failed save, so it came back on the next load with no sign anything had gone wrong. A failed storage read was also treated as "no shortcuts", so the next add or remove would have saved a list without any of the others.
  • After: the settings screen still removes the row at once, and a refused save puts back what storage holds. The remove sheet in a terminal session removes the row once the save lands. Adds and removes stop on a failed read and write nothing.
  • The settings screen had two copies of the same save queue (shortcut-bar layout and custom shortcuts). Both now use one hook, mobile/src/storage/use-serialized-stored-state.ts, so a refused layout save is restored the same way.

Screen-reader names (mobile)

  • These buttons now have a button role and a label: the home Settings gear, Back on pair-scan, pair-confirm and terminal settings, Tasks refresh and "+" (same wording as desktop's task page), Accounts refresh, and the shortcut remove button. The 32 to 36pt ones also get a larger tap area (hitSlop).
  • The chat Tools toggle reports expanded or collapsed.

Why

  • Mobile reuses desktop's existing rules instead of adding its own: fill only an empty box, no Generate while the box has text, Create PR off while generating (mobile instead stops the generation, since its Create PR commits the box's message).
  • A commit stops generation rather than Commit being disabled while generating. Writing your own message and committing means you've passed on the AI's version, so waiting for it or stopping it first would only add a step.
  • The settings screen keeps instant removal rather than waiting for the save, because the list can be dragged. Waiting meant a drag made during the save could bring the removed key back.

Linked Issue

Part of #29067 (items 1, 3 and 4). Item 2, Tasks paging, is in #30140.

Visual Proof

N/A. The labels only change what a screen reader announces. The commit-message and shortcut fixes cover timing and save-failure cases that look the same on screen; the tests below reproduce each one.

Testing

Each new test reproduces its bug and fails without the fix:

  • mobile-commit-during-generation.test.tsx: start generating, type, commit, then the AI answers late. The box stays empty.
  • use-commit-message-generation.cancel.test.ts (desktop): a stopped run's late success doesn't write the box.
  • use-mobile-commit-message-generation.test.ts and MobileSourceControlContent.test.tsx: typed text survives a reply; Generate is off while the box has text.
  • terminal-shortcut-settings-custom-keys.test.tsx: a refused removal shows the key again, and a reorder made while a removal saves keeps the key removed.
  • custom-key-modal-save-refusal.test.tsx: a failed read writes nothing on add or remove.

Not tried on an iOS or Android device, or with VoiceOver or TalkBack.

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

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No wire changes: mobile already had the cancel RPC, and desktop's Stop keeps routing to the repo's owner host, so SSH and remote hosts behave as before. Nothing is platform-specific.

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)

@coderabbitai

coderabbitai Bot commented Oct 18, 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: 95d51f58-fc56-4f51-842c-23109c73f825
📥 Commits

Reviewing files that changed from the base of the PR and between c2d4995 and 6cafd76.

📒 Files selected for processing: 4
  • mobile/src/components/CustomKeyModal.tsx
  • mobile/src/components/custom-key-modal-save-refusal.test.tsx
  • mobile/src/source-control/MobileSourceControlContent.test.tsx
  • mobile/src/source-control/MobileSourceControlContent.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Mobile controls gain accessibility metadata. Custom-key operations use serialized storage, and terminal shortcut settings use a shared stored-state hook. Mobile and desktop commit-message generation guard against stale results and preserve existing draft text. Mobile commits and create-PR workflows cancel generation before proceeding. Desktop commits without a target also cancel generation.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 6cafd

Some edge cases remain around stale generation errors, failed cancellation requests, and overlapping stored-state writes or refreshes. They could briefly show wrong state or drop a custom-key edit. They should be checked before merge, but they are narrow and recoverable.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 26.19% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 26 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the three main changes: preserving typed commit messages, restoring failed shortcut removals, and naming mobile icon buttons.
Description check Passed The description follows the required template and explains the user impact, implementation, rationale, linked issue, visual-proof decision, testing, platform considerations, and checklist status. It a…
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.
Full details: Description check

Explanation

The description follows the required template and explains the user impact, implementation, rationale, linked issue, visual-proof decision, testing, platform considerations, and checklist status. It also clearly notes that device and screen-reader testing was not performed.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · 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: 5


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2f631f43-0424-474d-9915-6b918b49953d
📥 Commits

Reviewing files that changed from the base of the PR and between ce2d608 and 87a6e74.

📒 Files selected for processing: 25
  • mobile/app/pair-confirm.tsx
  • mobile/app/pair-scan.tsx
  • mobile/app/terminal-settings.tsx
  • mobile/src/accounts/MobileAccountsScreen.tsx
  • mobile/src/components/CustomKeyModal.tsx
  • mobile/src/components/TerminalShortcutSettings.tsx
  • mobile/src/components/custom-key-modal-save-refusal.test.tsx
  • mobile/src/components/terminal-shortcut-settings-custom-keys.test.tsx
  • mobile/src/home/MobileHomeTopBar.tsx
  • mobile/src/session/MobileNativeChatFloatingControls.tsx
  • mobile/src/session/use-mobile-session-keyboard-state.test.tsx
  • mobile/src/session/use-mobile-session-keyboard-state.ts
  • mobile/src/source-control/MobileSourceControlContent.test.tsx
  • mobile/src/source-control/MobileSourceControlContent.tsx
  • mobile/src/source-control/mobile-commit-during-generation.test.tsx
  • mobile/src/source-control/use-mobile-commit-message-generation.test.ts
  • mobile/src/source-control/use-mobile-commit-message-generation.ts
  • mobile/src/source-control/use-mobile-create-pr-runner.ts
  • mobile/src/source-control/use-mobile-source-control-commit-runners.ts
  • mobile/src/source-control/use-mobile-source-control-runners.ts
  • mobile/src/storage/use-serialized-stored-state.ts
  • mobile/src/tasks/mobile-tasks-screen-chrome.tsx
  • src/renderer/src/components/right-sidebar/source-control/commit/use-commit-flows.ts
  • src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.cancel.test.ts
  • src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Comment on lines +92 to +96
export async function removeCustomKey(id: string): Promise<CustomKey[]> {
const updated = (await readStoredCustomKeys()).filter((key) => key.id !== id)
await saveCustomKeys(updated)
return updated
}

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Serialize removeCustomKey so concurrent removals do not restore a deleted key.

removeCustomKey reads the stored list, filters it, and writes it back. Nothing serializes these steps. Suppose the user removes key A and then key B before the first write lands. Both calls read [A, B, C]. The first call writes [B, C]. The second call then writes [A, C]. Key A returns to storage. The handler in use-mobile-session-keyboard-state.ts (Line 138) then calls setCustomKeys([A, C]), so key A also returns to the screen.

The old session handler removed the key from screen state immediately. With the new code, the key stays on screen until the write resolves. A second tap during that wait is therefore more likely. addKey has the same read-modify-write pattern and can race with a removal. Put both paths through one module-level write chain.

🔒️ Proposed fix: one write chain for read-modify-write operations
--- "a/mobile/src/components/CustomKeyModal.tsx"
+++ "b/mobile/src/components/CustomKeyModal.tsx"
@@ -89,11 +89,21 @@
 
 // Like addKey: resolves with the stored list only once the store took it, so a refused write
 // never drops a row from screen that the next load would bring back.
+// One custom-key read-modify-write at a time, so a second edit starts from the first one's result.
+let customKeyWriteChain: Promise<unknown> = Promise.resolve()
+function serializeCustomKeyWrite<T>(task: () => Promise<T>): Promise<T> {
+  const run = customKeyWriteChain.then(task, task)
+  customKeyWriteChain = run.catch(() => undefined)
+  return run
+}
+
 export async function removeCustomKey(id: string): Promise<CustomKey[]> {
-  const updated = (await readStoredCustomKeys()).filter((key) => key.id !== id)
-  await saveCustomKeys(updated)
-  return updated
+  return serializeCustomKeyWrite(async () => {
+    const updated = (await readStoredCustomKeys()).filter((key) => key.id !== id)
+    await saveCustomKeys(updated)
+    return updated
+  })
 }
 
 export function CustomKeyModal({ visible, onClose, onKeysChanged, onManageShortcuts }: Props) {
   const [step, setStep] = useState<Step>('choose-type')

In addKey, use the same chain:

updated = await serializeCustomKeyWrite(async () => {
  const next = [...(await readStoredCustomKeys()), newKey]
  await saveCustomKeys(next)
  return next
})

try {
const result = await requestMobileCommitMessage(client, worktreeId)
if (!mountedRef.current) {
if (!mountedRef.current || run !== runRef.current) {

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

Ignore errors from invalidated generation runs.

If a canceled request later rejects, the catch block at Line 61 still reports its error because it checks only mountedRef. That stale error can replace an error from the commit or Create PR action. Check run === runRef.current in the rejection path as well.

@AmoabaKelvin
AmoabaKelvin force-pushed the commit-message-and-shortcut-fixes branch from 87a6e74 to c2d4995 Compare October 18, 2026 02:26

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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5fab845f-c332-4d9b-8580-40e903dd4de5
📥 Commits

Reviewing files that changed from the base of the PR and between 87a6e74 and c2d4995.

📒 Files selected for processing: 6
  • mobile/src/components/CustomKeyModal.tsx
  • mobile/src/components/custom-key-modal-save-refusal.test.tsx
  • mobile/src/source-control/use-mobile-commit-message-generation.test.ts
  • mobile/src/source-control/use-mobile-commit-message-generation.ts
  • mobile/src/storage/use-serialized-stored-state.test.ts
  • mobile/src/storage/use-serialized-stored-state.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

A late AI reply replaced text typed while it ran on mobile, and on both
desktop and mobile it refilled the box right after a commit emptied it.
Settings, Back, refresh and new-task buttons read as just "button" in
VoiceOver and TalkBack; the chat Tools toggle now reports expanded state.
A refused save left the key hidden until the next load. Removals and adds
also stop on a failed storage read instead of saving an empty list.
Two quick shortcut removals could restore the first key. A stopped run's
late failure or a failed cancel request could still surface as an error.
A settings save in flight could land over an add or a removal and undo it.
@AmoabaKelvin
AmoabaKelvin force-pushed the commit-message-and-shortcut-fixes branch from c2d4995 to 6cafd76 Compare October 18, 2026 18:55
@AmoabaKelvin
AmoabaKelvin merged commit b0a7d2e into main Oct 18, 2026
34 checks passed
@AmoabaKelvin
AmoabaKelvin deleted the commit-message-and-shortcut-fixes branch October 18, 2026 20:05
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.

1 participant