Skip to content

fix(mobile): make image send retries safe - #10228

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/mobile-image-retry-safety
Jul 23, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/mobile-image-retry-safety

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

  • track stale native-chat image input independently per terminal
  • fail closed when healing a rejected image send cannot clear the terminal input
  • serialize clear, paste, settle, and submit ownership per terminal while allowing other terminals to proceed
  • cover rejected clears, chip removal, tab switches, overlapping sends, and multi-terminal retries

Testing

  • 349 mobile test files passed; 2,549 tests passed and 2 skipped
  • mobile typecheck
  • mobile lint
  • mobile format check

Follow-up to #10135. Supersedes #9981.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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)

Check name Status Explanation Resolution
Description check ⚠️ Warning Summary and Testing are present, but Screenshots, AI Review Report, Security Audit, and Notes are missing. Add the missing template sections, including screenshots/no visual change, AI review, security audit, and notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: safer mobile image-send retries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

🧹 Nitpick comments (1)
mobile/src/session/use-mobile-native-chat-image-attachments.ts (1)

209-313: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: extract the repeated failure trio.

The onError?.(); showToast('Message not sent', 1500); return false sequence 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

📥 Commits

Reviewing files that changed from the base of the PR and between 94d3db4 and 4ad7c4c.

📒 Files selected for processing (2)
  • mobile/src/session/use-mobile-native-chat-image-attachments.test.ts
  • mobile/src/session/use-mobile-native-chat-image-attachments.ts

@brennanb2025
brennanb2025 merged commit 06f6e3b into main Jul 23, 2026
3 checks passed
brennanb2025 added a commit that referenced this pull request Jul 28, 2026
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.
brennanb2025 added a commit that referenced this pull request Jul 28, 2026
…#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.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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.
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