Repository navigation
fix(mobile): make image send retries safe - #10228
Conversation
📝 WalkthroughWalkthroughThe hook now tracks stale input and in-flight sends per terminal. It performs terminal-specific healing, blocks duplicate sends, aborts when the active terminal changes during settling, and clears only chips included in accepted sends. Tests add deferred RPC support and cover concurrent sends, rejected healing clears, terminal changes, and independent retries across tab scopes. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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.
🧹 Nitpick comments (1)
mobile/src/session/use-mobile-native-chat-image-attachments.ts (1)
209-313: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: extract the repeated failure trio.
The
onError?.(); showToast('Message not sent', 1500); return falsesequence recurs across the guard, healing, paste, terminal-change, and catch branches. A small local helper keeps the surface consistent and makes future message/telemetry changes single-site. Behavior is otherwise correct.♻️ Illustrative helper
+ const failSend = (message = 'Message not sent'): false => { + onError?.() + showToast(message, 1500) + return false + } const operationTerminal = activeHandleRef.current if (operationTerminal && sendInFlightTerminalsRef.current.has(operationTerminal)) { - onError?.() - showToast('Message not sent', 1500) - return false + return failSend() }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 436d2b24-42c2-4522-b9f1-0233f653d114
📒 Files selected for processing (2)
mobile/src/session/use-mobile-native-chat-image-attachments.test.tsmobile/src/session/use-mobile-native-chat-image-attachments.ts
Keeps the terminal-handle keying and the #10228 link (why a NativeChat-named helper runs in diff review) and the deviceToken rationale; drops the clause that restated the call. Addresses CodeRabbit review feedback.
…#11035) * fix(mobile): heal a stale input line before sending diff-review notes The stale-input marker is keyed by terminal handle, not by surface, so a paste orphaned on a terminal by native chat is still marked when the user sends diff-review notes to that same terminal — and those notes were submitted on top of it. Gate the send on the heal, as the native-chat answer send already does; when the clear fails, surface the error instead of dropping the note silently. Completes a follow-up deliberately deferred by #10480. * test(mobile): assert the post-heal send carries the notes, not another clear * style(mobile): trim the stale-heal comment to its non-obvious why Keeps the terminal-handle keying and the #10228 link (why a NativeChat-named helper runs in diff review) and the deviceToken rationale; drops the clause that restated the call. Addresses CodeRabbit review feedback.
…stablyai#11035) * fix(mobile): heal a stale input line before sending diff-review notes The stale-input marker is keyed by terminal handle, not by surface, so a paste orphaned on a terminal by native chat is still marked when the user sends diff-review notes to that same terminal — and those notes were submitted on top of it. Gate the send on the heal, as the native-chat answer send already does; when the clear fails, surface the error instead of dropping the note silently. Completes a follow-up deliberately deferred by stablyai#10480. * test(mobile): assert the post-heal send carries the notes, not another clear * style(mobile): trim the stale-heal comment to its non-obvious why Keeps the terminal-handle keying and the stablyai#10228 link (why a NativeChat-named helper runs in diff review) and the deviceToken rationale; drops the clause that restated the call. Addresses CodeRabbit review feedback.
Summary
Testing
Follow-up to #10135. Supersedes #9981.