Repository navigation
fix(mobile): keep typed commit messages, restore failed shortcut removals, name icon buttons - #30142
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2f631f43-0424-474d-9915-6b918b49953d
📒 Files selected for processing: 25
mobile/app/pair-confirm.tsxmobile/app/pair-scan.tsxmobile/app/terminal-settings.tsxmobile/src/accounts/MobileAccountsScreen.tsxmobile/src/components/CustomKeyModal.tsxmobile/src/components/TerminalShortcutSettings.tsxmobile/src/components/custom-key-modal-save-refusal.test.tsxmobile/src/components/terminal-shortcut-settings-custom-keys.test.tsxmobile/src/home/MobileHomeTopBar.tsxmobile/src/session/MobileNativeChatFloatingControls.tsxmobile/src/session/use-mobile-session-keyboard-state.test.tsxmobile/src/session/use-mobile-session-keyboard-state.tsmobile/src/source-control/MobileSourceControlContent.test.tsxmobile/src/source-control/MobileSourceControlContent.tsxmobile/src/source-control/mobile-commit-during-generation.test.tsxmobile/src/source-control/use-mobile-commit-message-generation.test.tsmobile/src/source-control/use-mobile-commit-message-generation.tsmobile/src/source-control/use-mobile-create-pr-runner.tsmobile/src/source-control/use-mobile-source-control-commit-runners.tsmobile/src/source-control/use-mobile-source-control-runners.tsmobile/src/storage/use-serialized-stored-state.tsmobile/src/tasks/mobile-tasks-screen-chrome.tsxsrc/renderer/src/components/right-sidebar/source-control/commit/use-commit-flows.tssrc/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.cancel.test.tssrc/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.
| export async function removeCustomKey(id: string): Promise<CustomKey[]> { | ||
| const updated = (await readStoredCustomKeys()).filter((key) => key.id !== id) | ||
| await saveCustomKeys(updated) | ||
| return updated | ||
| } |
There was a problem hiding this comment.
🗄️ 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) { |
There was a problem hiding this comment.
🎯 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.
87a6e74 to
c2d4995
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5fab845f-c332-4d9b-8580-40e903dd4de5
📒 Files selected for processing: 6
mobile/src/components/CustomKeyModal.tsxmobile/src/components/custom-key-modal-save-refusal.test.tsxmobile/src/source-control/use-mobile-commit-message-generation.test.tsmobile/src/source-control/use-mobile-commit-message-generation.tsmobile/src/storage/use-serialized-stored-state.test.tsmobile/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.
c2d4995 to
6cafd76
Compare
ELI5
Fixes from #29067, mostly on mobile:
What Changed
AI commit message (mobile, and desktop for one case)
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)
mobile/src/storage/use-serialized-stored-state.ts, so a refused layout save is restored the same way.Screen-reader names (mobile)
hitSlop).Why
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.tsandMobileSourceControlContent.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.
Agent skill upstream boundary
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)