Skip to content

fix(mobile): heal terminal input after ambiguous image-send delivery - #10325

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-10228-mobile-image-bleed
Jul 24, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-10228-mobile-image-bleed

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the mobile P1 follow-up to fix(mobile): make image send retries safe #10228: after an image send whose text+Enter RPC ends delivery-ambiguous ('unknown': ack loss / relay-direct cutover / request timeout) but truly never landed, the already-pasted image path stayed on the terminal input line and silently glued onto the next plain-text message.
  • Root cause: handleNativeChatSend collapsed 'unknown' to accepted=true, so the image hook's markTerminalInputStale only ran on hard reject — the ambiguous subcase never armed the healing Ctrl+U.
  • Fix: add handleNativeChatSendWithOutcome (outcome-preserving surface; boolean wrapper keeps existing callers unchanged) and wire the image-attachments hook to it. Any non-accepted outcome after a successful paste now marks that terminal's input stale, so the next send leads with the healing Ctrl+U — a no-op when the message actually landed. Chips still clear on 'unknown' (the send usually did land; a kept chip would double-send on retry), and the unconfirmed-delivery toast still shows.

Testing

  • New unit tests: unknown-after-paste heals before the next text-only send; unknown text-only send does not heal (nothing pasted); controller preserves 'unknown' on the WithOutcome surface.
  • Full mobile suite: 329 files, 2386 passed / 2 skipped. Typecheck, oxlint, format check clean.
  • Live emulator QA (iPhone 17 Pro sim + branch dev desktop, LAN pairing): reproduced the exact subcase by dropping the armed terminal.send frame pre-wire in the app's Hermes runtime, letting the app's own 30s timeout mark delivery-unknown. The image paste landed (desktop claude input showed the orphaned [Image #1], message not submitted); the follow-up plain-text send healed the input and arrived clean — claude answered "no-image". Before this fix the orphan rode onto that later message.

Orphaned image on desktop input after the ambiguous send (paste landed, Enter lost):
orphan

Follow-up message arrives clean on both sides (healing Ctrl+U preceded it):
desktop
mobile

Notes

  • 'rejected' behavior is unchanged (stale marker + kept chips + "Message not sent").
  • Text-only sends never mark stale on 'unknown' — nothing was pasted first.

An image send whose text+Enter RPC ended 'unknown' (ack loss / path
cutover) collapsed to accepted=true, so the terminal was never marked
stale. When the Enter truly never landed, the already-pasted image path
sat on the input line and glued onto the next plain-text message.

Propagate the send outcome through handleNativeChatSendWithOutcome and
mark the terminal input stale on any non-accepted outcome; the next send
heals with Ctrl+U (a no-op when the message did land). Chips still clear
on 'unknown' to avoid a double-send on retry.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 16ed606c-bb87-4ae7-8271-a2ac95f536d3

📥 Commits

Reviewing files that changed from the base of the PR and between c88cf84 and 31fab99.

📒 Files selected for processing (6)
  • mobile/app/h/[hostId]/session/[worktreeId].tsx
  • mobile/src/session/use-mobile-native-chat-controller.test.ts
  • mobile/src/session/use-mobile-native-chat-controller.ts
  • mobile/src/session/use-mobile-native-chat-image-attachments.test.ts
  • mobile/src/session/use-mobile-native-chat-image-attachments.ts
  • mobile/src/session/use-mobile-session-image-attachments.ts

📝 Walkthrough

Walkthrough

Native chat sends now expose accepted, rejected, and unknown outcomes. The existing boolean send method converts these outcomes for compatibility, while image-attachment hooks preserve outcome details to manage stale markers and attachment chips. The session screen uses the new outcome-preserving method. Tests update send mocks to status tokens and cover ambiguous image delivery healing and text-only behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, testing, and notes, but omits required Screenshots, AI Review Report, and Security Audit sections. Add the missing template sections: Screenshots (or 'No visual change'), the testing checklist, an AI review report with macOS/Linux/Windows coverage, and a security audit summary.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: preserving ambiguous image-send outcomes to heal terminal input.
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.

@brennanb2025
brennanb2025 merged commit e651fe9 into main Jul 24, 2026
3 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#10325)

An image send whose text+Enter RPC ended 'unknown' (ack loss / path
cutover) collapsed to accepted=true, so the terminal was never marked
stale. When the Enter truly never landed, the already-pasted image path
sat on the input line and glued onto the next plain-text message.

Propagate the send outcome through handleNativeChatSendWithOutcome and
mark the terminal input stale on any non-accepted outcome; the next send
heals with Ctrl+U (a no-op when the message did land). Chips still clear
on 'unknown' to avoid a double-send on retry.
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